Left Termination of the query pattern test_snake_in_3(g, g, g) w.r.t. the given Prolog program could not be shown:



Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof

Clauses:

test_snake(Pattern, C, R) :- ','(s2l(C, Cols), ','(s2l(R, Rows), snake(Pattern, Cols, Rows))).
s2l(0, []).
s2l(s(X), .(X1, Y)) :- s2l(X, Y).
snake(Pattern, Cols, Rows) :- ','(infinite_snake(Pattern, InfSnake, InfSnake), ','(produce_snake(Rows, Cols, InfSnake, Snake), coil_it(Snake, odd))).
infinite_snake([], S, S).
infinite_snake(.(A, R), .(A, T), S) :- infinite_snake(R, T, S).
produce_snake([], X, X1, []).
produce_snake(.(X, Rows), Cols, InfSnake, .(Part, Tail)) :- ','(part_of_snake(Cols, InfSnake, NewInfSnake, Part), produce_snake(Rows, Cols, NewInfSnake, Tail)).
part_of_snake([], RestSnake, RestSnake, []).
part_of_snake(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) :- part_of_snake(R, Rings, RestSnake, RestRings).
coil_it([], X).
coil_it(.(Line, Lines), odd) :- coil_it(Lines, even).
coil_it(.(Line, Lines), even) :- ','(reverse2(Line, Line1), coil_it(Lines, odd)).
reverse2(List, Reversed) :- reverse(List, [], Reversed).
reverse([], Reversed, Reversed).
reverse(.(Head, Tail), SoFar, Reversed) :- reverse(Tail, .(Head, SoFar), Reversed).

Queries:

test_snake(g,g,g).

We use the technique of [30]. With regard to the inferred argument filtering the predicates were used in the following modes:
test_snake_in: (b,b,b)
s2l_in: (b,f)
snake_in: (b,f,f)
infinite_snake_in: (b,f,f)
produce_snake_in: (f,f,f,f)
part_of_snake_in: (f,f,f,f)
coil_it_in: (f,b)
reverse2_in: (f,f)
reverse_in: (f,b,f) (f,f,f)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

test_snake_in_ggg(Pattern, C, R) → U1_ggg(Pattern, C, R, s2l_in_ga(C, Cols))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
s2l_in_ga(s(X), .(X1, Y)) → U4_ga(X, X1, Y, s2l_in_ga(X, Y))
U4_ga(X, X1, Y, s2l_out_ga(X, Y)) → s2l_out_ga(s(X), .(X1, Y))
U1_ggg(Pattern, C, R, s2l_out_ga(C, Cols)) → U2_ggg(Pattern, C, R, Cols, s2l_in_ga(R, Rows))
U2_ggg(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → U3_ggg(Pattern, C, R, snake_in_gaa(Pattern, Cols, Rows))
snake_in_gaa(Pattern, Cols, Rows) → U5_gaa(Pattern, Cols, Rows, infinite_snake_in_gaa(Pattern, InfSnake, InfSnake))
infinite_snake_in_gaa([], S, S) → infinite_snake_out_gaa([], S, S)
infinite_snake_in_gaa(.(A, R), .(A, T), S) → U8_gaa(A, R, T, S, infinite_snake_in_gaa(R, T, S))
U8_gaa(A, R, T, S, infinite_snake_out_gaa(R, T, S)) → infinite_snake_out_gaa(.(A, R), .(A, T), S)
U5_gaa(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → U6_gaa(Pattern, Cols, Rows, produce_snake_in_aaaa(Rows, Cols, InfSnake, Snake))
produce_snake_in_aaaa([], X, X1, []) → produce_snake_out_aaaa([], X, X1, [])
produce_snake_in_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
part_of_snake_in_aaaa([], RestSnake, RestSnake, []) → part_of_snake_out_aaaa([], RestSnake, RestSnake, [])
part_of_snake_in_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_out_aaaa(R, Rings, RestSnake, RestRings)) → part_of_snake_out_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings))
U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_in_aaaa(Rows, Cols, NewInfSnake, Tail))
U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_out_aaaa(Rows, Cols, NewInfSnake, Tail)) → produce_snake_out_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail))
U6_gaa(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → U7_gaa(Pattern, Cols, Rows, coil_it_in_ag(Snake, odd))
coil_it_in_ag([], X) → coil_it_out_ag([], X)
coil_it_in_ag(.(Line, Lines), odd) → U12_ag(Line, Lines, coil_it_in_ag(Lines, even))
coil_it_in_ag(.(Line, Lines), even) → U13_ag(Line, Lines, reverse2_in_aa(Line, Line1))
reverse2_in_aa(List, Reversed) → U15_aa(List, Reversed, reverse_in_aga(List, [], Reversed))
reverse_in_aga([], Reversed, Reversed) → reverse_out_aga([], Reversed, Reversed)
reverse_in_aga(.(Head, Tail), SoFar, Reversed) → U16_aga(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
reverse_in_aaa([], Reversed, Reversed) → reverse_out_aaa([], Reversed, Reversed)
reverse_in_aaa(.(Head, Tail), SoFar, Reversed) → U16_aaa(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
U16_aaa(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aaa(.(Head, Tail), SoFar, Reversed)
U16_aga(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aga(.(Head, Tail), SoFar, Reversed)
U15_aa(List, Reversed, reverse_out_aga(List, [], Reversed)) → reverse2_out_aa(List, Reversed)
U13_ag(Line, Lines, reverse2_out_aa(Line, Line1)) → U14_ag(Line, Lines, coil_it_in_ag(Lines, odd))
U14_ag(Line, Lines, coil_it_out_ag(Lines, odd)) → coil_it_out_ag(.(Line, Lines), even)
U12_ag(Line, Lines, coil_it_out_ag(Lines, even)) → coil_it_out_ag(.(Line, Lines), odd)
U7_gaa(Pattern, Cols, Rows, coil_it_out_ag(Snake, odd)) → snake_out_gaa(Pattern, Cols, Rows)
U3_ggg(Pattern, C, R, snake_out_gaa(Pattern, Cols, Rows)) → test_snake_out_ggg(Pattern, C, R)

The argument filtering Pi contains the following mapping:
test_snake_in_ggg(x1, x2, x3)  =  test_snake_in_ggg(x1, x2, x3)
U1_ggg(x1, x2, x3, x4)  =  U1_ggg(x1, x3, x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga
s(x1)  =  s(x1)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
U2_ggg(x1, x2, x3, x4, x5)  =  U2_ggg(x1, x5)
U3_ggg(x1, x2, x3, x4)  =  U3_ggg(x4)
snake_in_gaa(x1, x2, x3)  =  snake_in_gaa(x1)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x4)
infinite_snake_in_gaa(x1, x2, x3)  =  infinite_snake_in_gaa(x1)
[]  =  []
infinite_snake_out_gaa(x1, x2, x3)  =  infinite_snake_out_gaa
.(x1, x2)  =  .(x1, x2)
U8_gaa(x1, x2, x3, x4, x5)  =  U8_gaa(x5)
U6_gaa(x1, x2, x3, x4)  =  U6_gaa(x4)
produce_snake_in_aaaa(x1, x2, x3, x4)  =  produce_snake_in_aaaa
produce_snake_out_aaaa(x1, x2, x3, x4)  =  produce_snake_out_aaaa
U9_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U9_aaaa(x7)
part_of_snake_in_aaaa(x1, x2, x3, x4)  =  part_of_snake_in_aaaa
part_of_snake_out_aaaa(x1, x2, x3, x4)  =  part_of_snake_out_aaaa
U11_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U11_aaaa(x7)
U10_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U10_aaaa(x7)
U7_gaa(x1, x2, x3, x4)  =  U7_gaa(x4)
coil_it_in_ag(x1, x2)  =  coil_it_in_ag(x2)
coil_it_out_ag(x1, x2)  =  coil_it_out_ag
odd  =  odd
U12_ag(x1, x2, x3)  =  U12_ag(x3)
even  =  even
U13_ag(x1, x2, x3)  =  U13_ag(x3)
reverse2_in_aa(x1, x2)  =  reverse2_in_aa
U15_aa(x1, x2, x3)  =  U15_aa(x3)
reverse_in_aga(x1, x2, x3)  =  reverse_in_aga(x2)
reverse_out_aga(x1, x2, x3)  =  reverse_out_aga
U16_aga(x1, x2, x3, x4, x5)  =  U16_aga(x5)
reverse_in_aaa(x1, x2, x3)  =  reverse_in_aaa
reverse_out_aaa(x1, x2, x3)  =  reverse_out_aaa
U16_aaa(x1, x2, x3, x4, x5)  =  U16_aaa(x5)
reverse2_out_aa(x1, x2)  =  reverse2_out_aa
U14_ag(x1, x2, x3)  =  U14_ag(x3)
snake_out_gaa(x1, x2, x3)  =  snake_out_gaa
test_snake_out_ggg(x1, x2, x3)  =  test_snake_out_ggg

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog



↳ Prolog
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof
  ↳ PrologToPiTRSProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

test_snake_in_ggg(Pattern, C, R) → U1_ggg(Pattern, C, R, s2l_in_ga(C, Cols))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
s2l_in_ga(s(X), .(X1, Y)) → U4_ga(X, X1, Y, s2l_in_ga(X, Y))
U4_ga(X, X1, Y, s2l_out_ga(X, Y)) → s2l_out_ga(s(X), .(X1, Y))
U1_ggg(Pattern, C, R, s2l_out_ga(C, Cols)) → U2_ggg(Pattern, C, R, Cols, s2l_in_ga(R, Rows))
U2_ggg(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → U3_ggg(Pattern, C, R, snake_in_gaa(Pattern, Cols, Rows))
snake_in_gaa(Pattern, Cols, Rows) → U5_gaa(Pattern, Cols, Rows, infinite_snake_in_gaa(Pattern, InfSnake, InfSnake))
infinite_snake_in_gaa([], S, S) → infinite_snake_out_gaa([], S, S)
infinite_snake_in_gaa(.(A, R), .(A, T), S) → U8_gaa(A, R, T, S, infinite_snake_in_gaa(R, T, S))
U8_gaa(A, R, T, S, infinite_snake_out_gaa(R, T, S)) → infinite_snake_out_gaa(.(A, R), .(A, T), S)
U5_gaa(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → U6_gaa(Pattern, Cols, Rows, produce_snake_in_aaaa(Rows, Cols, InfSnake, Snake))
produce_snake_in_aaaa([], X, X1, []) → produce_snake_out_aaaa([], X, X1, [])
produce_snake_in_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
part_of_snake_in_aaaa([], RestSnake, RestSnake, []) → part_of_snake_out_aaaa([], RestSnake, RestSnake, [])
part_of_snake_in_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_out_aaaa(R, Rings, RestSnake, RestRings)) → part_of_snake_out_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings))
U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_in_aaaa(Rows, Cols, NewInfSnake, Tail))
U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_out_aaaa(Rows, Cols, NewInfSnake, Tail)) → produce_snake_out_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail))
U6_gaa(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → U7_gaa(Pattern, Cols, Rows, coil_it_in_ag(Snake, odd))
coil_it_in_ag([], X) → coil_it_out_ag([], X)
coil_it_in_ag(.(Line, Lines), odd) → U12_ag(Line, Lines, coil_it_in_ag(Lines, even))
coil_it_in_ag(.(Line, Lines), even) → U13_ag(Line, Lines, reverse2_in_aa(Line, Line1))
reverse2_in_aa(List, Reversed) → U15_aa(List, Reversed, reverse_in_aga(List, [], Reversed))
reverse_in_aga([], Reversed, Reversed) → reverse_out_aga([], Reversed, Reversed)
reverse_in_aga(.(Head, Tail), SoFar, Reversed) → U16_aga(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
reverse_in_aaa([], Reversed, Reversed) → reverse_out_aaa([], Reversed, Reversed)
reverse_in_aaa(.(Head, Tail), SoFar, Reversed) → U16_aaa(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
U16_aaa(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aaa(.(Head, Tail), SoFar, Reversed)
U16_aga(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aga(.(Head, Tail), SoFar, Reversed)
U15_aa(List, Reversed, reverse_out_aga(List, [], Reversed)) → reverse2_out_aa(List, Reversed)
U13_ag(Line, Lines, reverse2_out_aa(Line, Line1)) → U14_ag(Line, Lines, coil_it_in_ag(Lines, odd))
U14_ag(Line, Lines, coil_it_out_ag(Lines, odd)) → coil_it_out_ag(.(Line, Lines), even)
U12_ag(Line, Lines, coil_it_out_ag(Lines, even)) → coil_it_out_ag(.(Line, Lines), odd)
U7_gaa(Pattern, Cols, Rows, coil_it_out_ag(Snake, odd)) → snake_out_gaa(Pattern, Cols, Rows)
U3_ggg(Pattern, C, R, snake_out_gaa(Pattern, Cols, Rows)) → test_snake_out_ggg(Pattern, C, R)

The argument filtering Pi contains the following mapping:
test_snake_in_ggg(x1, x2, x3)  =  test_snake_in_ggg(x1, x2, x3)
U1_ggg(x1, x2, x3, x4)  =  U1_ggg(x1, x3, x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga
s(x1)  =  s(x1)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
U2_ggg(x1, x2, x3, x4, x5)  =  U2_ggg(x1, x5)
U3_ggg(x1, x2, x3, x4)  =  U3_ggg(x4)
snake_in_gaa(x1, x2, x3)  =  snake_in_gaa(x1)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x4)
infinite_snake_in_gaa(x1, x2, x3)  =  infinite_snake_in_gaa(x1)
[]  =  []
infinite_snake_out_gaa(x1, x2, x3)  =  infinite_snake_out_gaa
.(x1, x2)  =  .(x1, x2)
U8_gaa(x1, x2, x3, x4, x5)  =  U8_gaa(x5)
U6_gaa(x1, x2, x3, x4)  =  U6_gaa(x4)
produce_snake_in_aaaa(x1, x2, x3, x4)  =  produce_snake_in_aaaa
produce_snake_out_aaaa(x1, x2, x3, x4)  =  produce_snake_out_aaaa
U9_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U9_aaaa(x7)
part_of_snake_in_aaaa(x1, x2, x3, x4)  =  part_of_snake_in_aaaa
part_of_snake_out_aaaa(x1, x2, x3, x4)  =  part_of_snake_out_aaaa
U11_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U11_aaaa(x7)
U10_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U10_aaaa(x7)
U7_gaa(x1, x2, x3, x4)  =  U7_gaa(x4)
coil_it_in_ag(x1, x2)  =  coil_it_in_ag(x2)
coil_it_out_ag(x1, x2)  =  coil_it_out_ag
odd  =  odd
U12_ag(x1, x2, x3)  =  U12_ag(x3)
even  =  even
U13_ag(x1, x2, x3)  =  U13_ag(x3)
reverse2_in_aa(x1, x2)  =  reverse2_in_aa
U15_aa(x1, x2, x3)  =  U15_aa(x3)
reverse_in_aga(x1, x2, x3)  =  reverse_in_aga(x2)
reverse_out_aga(x1, x2, x3)  =  reverse_out_aga
U16_aga(x1, x2, x3, x4, x5)  =  U16_aga(x5)
reverse_in_aaa(x1, x2, x3)  =  reverse_in_aaa
reverse_out_aaa(x1, x2, x3)  =  reverse_out_aaa
U16_aaa(x1, x2, x3, x4, x5)  =  U16_aaa(x5)
reverse2_out_aa(x1, x2)  =  reverse2_out_aa
U14_ag(x1, x2, x3)  =  U14_ag(x3)
snake_out_gaa(x1, x2, x3)  =  snake_out_gaa
test_snake_out_ggg(x1, x2, x3)  =  test_snake_out_ggg


Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

TEST_SNAKE_IN_GGG(Pattern, C, R) → U1_GGG(Pattern, C, R, s2l_in_ga(C, Cols))
TEST_SNAKE_IN_GGG(Pattern, C, R) → S2L_IN_GA(C, Cols)
S2L_IN_GA(s(X), .(X1, Y)) → U4_GA(X, X1, Y, s2l_in_ga(X, Y))
S2L_IN_GA(s(X), .(X1, Y)) → S2L_IN_GA(X, Y)
U1_GGG(Pattern, C, R, s2l_out_ga(C, Cols)) → U2_GGG(Pattern, C, R, Cols, s2l_in_ga(R, Rows))
U1_GGG(Pattern, C, R, s2l_out_ga(C, Cols)) → S2L_IN_GA(R, Rows)
U2_GGG(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → U3_GGG(Pattern, C, R, snake_in_gaa(Pattern, Cols, Rows))
U2_GGG(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → SNAKE_IN_GAA(Pattern, Cols, Rows)
SNAKE_IN_GAA(Pattern, Cols, Rows) → U5_GAA(Pattern, Cols, Rows, infinite_snake_in_gaa(Pattern, InfSnake, InfSnake))
SNAKE_IN_GAA(Pattern, Cols, Rows) → INFINITE_SNAKE_IN_GAA(Pattern, InfSnake, InfSnake)
INFINITE_SNAKE_IN_GAA(.(A, R), .(A, T), S) → U8_GAA(A, R, T, S, infinite_snake_in_gaa(R, T, S))
INFINITE_SNAKE_IN_GAA(.(A, R), .(A, T), S) → INFINITE_SNAKE_IN_GAA(R, T, S)
U5_GAA(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → U6_GAA(Pattern, Cols, Rows, produce_snake_in_aaaa(Rows, Cols, InfSnake, Snake))
U5_GAA(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → PRODUCE_SNAKE_IN_AAAA(Rows, Cols, InfSnake, Snake)
PRODUCE_SNAKE_IN_AAAA(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_AAAA(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
PRODUCE_SNAKE_IN_AAAA(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → PART_OF_SNAKE_IN_AAAA(Cols, InfSnake, NewInfSnake, Part)
PART_OF_SNAKE_IN_AAAA(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_AAAA(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
PART_OF_SNAKE_IN_AAAA(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → PART_OF_SNAKE_IN_AAAA(R, Rings, RestSnake, RestRings)
U9_AAAA(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → U10_AAAA(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_in_aaaa(Rows, Cols, NewInfSnake, Tail))
U9_AAAA(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → PRODUCE_SNAKE_IN_AAAA(Rows, Cols, NewInfSnake, Tail)
U6_GAA(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → U7_GAA(Pattern, Cols, Rows, coil_it_in_ag(Snake, odd))
U6_GAA(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → COIL_IT_IN_AG(Snake, odd)
COIL_IT_IN_AG(.(Line, Lines), odd) → U12_AG(Line, Lines, coil_it_in_ag(Lines, even))
COIL_IT_IN_AG(.(Line, Lines), odd) → COIL_IT_IN_AG(Lines, even)
COIL_IT_IN_AG(.(Line, Lines), even) → U13_AG(Line, Lines, reverse2_in_aa(Line, Line1))
COIL_IT_IN_AG(.(Line, Lines), even) → REVERSE2_IN_AA(Line, Line1)
REVERSE2_IN_AA(List, Reversed) → U15_AA(List, Reversed, reverse_in_aga(List, [], Reversed))
REVERSE2_IN_AA(List, Reversed) → REVERSE_IN_AGA(List, [], Reversed)
REVERSE_IN_AGA(.(Head, Tail), SoFar, Reversed) → U16_AGA(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
REVERSE_IN_AGA(.(Head, Tail), SoFar, Reversed) → REVERSE_IN_AAA(Tail, .(Head, SoFar), Reversed)
REVERSE_IN_AAA(.(Head, Tail), SoFar, Reversed) → U16_AAA(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
REVERSE_IN_AAA(.(Head, Tail), SoFar, Reversed) → REVERSE_IN_AAA(Tail, .(Head, SoFar), Reversed)
U13_AG(Line, Lines, reverse2_out_aa(Line, Line1)) → U14_AG(Line, Lines, coil_it_in_ag(Lines, odd))
U13_AG(Line, Lines, reverse2_out_aa(Line, Line1)) → COIL_IT_IN_AG(Lines, odd)

The TRS R consists of the following rules:

test_snake_in_ggg(Pattern, C, R) → U1_ggg(Pattern, C, R, s2l_in_ga(C, Cols))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
s2l_in_ga(s(X), .(X1, Y)) → U4_ga(X, X1, Y, s2l_in_ga(X, Y))
U4_ga(X, X1, Y, s2l_out_ga(X, Y)) → s2l_out_ga(s(X), .(X1, Y))
U1_ggg(Pattern, C, R, s2l_out_ga(C, Cols)) → U2_ggg(Pattern, C, R, Cols, s2l_in_ga(R, Rows))
U2_ggg(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → U3_ggg(Pattern, C, R, snake_in_gaa(Pattern, Cols, Rows))
snake_in_gaa(Pattern, Cols, Rows) → U5_gaa(Pattern, Cols, Rows, infinite_snake_in_gaa(Pattern, InfSnake, InfSnake))
infinite_snake_in_gaa([], S, S) → infinite_snake_out_gaa([], S, S)
infinite_snake_in_gaa(.(A, R), .(A, T), S) → U8_gaa(A, R, T, S, infinite_snake_in_gaa(R, T, S))
U8_gaa(A, R, T, S, infinite_snake_out_gaa(R, T, S)) → infinite_snake_out_gaa(.(A, R), .(A, T), S)
U5_gaa(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → U6_gaa(Pattern, Cols, Rows, produce_snake_in_aaaa(Rows, Cols, InfSnake, Snake))
produce_snake_in_aaaa([], X, X1, []) → produce_snake_out_aaaa([], X, X1, [])
produce_snake_in_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
part_of_snake_in_aaaa([], RestSnake, RestSnake, []) → part_of_snake_out_aaaa([], RestSnake, RestSnake, [])
part_of_snake_in_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_out_aaaa(R, Rings, RestSnake, RestRings)) → part_of_snake_out_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings))
U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_in_aaaa(Rows, Cols, NewInfSnake, Tail))
U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_out_aaaa(Rows, Cols, NewInfSnake, Tail)) → produce_snake_out_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail))
U6_gaa(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → U7_gaa(Pattern, Cols, Rows, coil_it_in_ag(Snake, odd))
coil_it_in_ag([], X) → coil_it_out_ag([], X)
coil_it_in_ag(.(Line, Lines), odd) → U12_ag(Line, Lines, coil_it_in_ag(Lines, even))
coil_it_in_ag(.(Line, Lines), even) → U13_ag(Line, Lines, reverse2_in_aa(Line, Line1))
reverse2_in_aa(List, Reversed) → U15_aa(List, Reversed, reverse_in_aga(List, [], Reversed))
reverse_in_aga([], Reversed, Reversed) → reverse_out_aga([], Reversed, Reversed)
reverse_in_aga(.(Head, Tail), SoFar, Reversed) → U16_aga(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
reverse_in_aaa([], Reversed, Reversed) → reverse_out_aaa([], Reversed, Reversed)
reverse_in_aaa(.(Head, Tail), SoFar, Reversed) → U16_aaa(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
U16_aaa(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aaa(.(Head, Tail), SoFar, Reversed)
U16_aga(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aga(.(Head, Tail), SoFar, Reversed)
U15_aa(List, Reversed, reverse_out_aga(List, [], Reversed)) → reverse2_out_aa(List, Reversed)
U13_ag(Line, Lines, reverse2_out_aa(Line, Line1)) → U14_ag(Line, Lines, coil_it_in_ag(Lines, odd))
U14_ag(Line, Lines, coil_it_out_ag(Lines, odd)) → coil_it_out_ag(.(Line, Lines), even)
U12_ag(Line, Lines, coil_it_out_ag(Lines, even)) → coil_it_out_ag(.(Line, Lines), odd)
U7_gaa(Pattern, Cols, Rows, coil_it_out_ag(Snake, odd)) → snake_out_gaa(Pattern, Cols, Rows)
U3_ggg(Pattern, C, R, snake_out_gaa(Pattern, Cols, Rows)) → test_snake_out_ggg(Pattern, C, R)

The argument filtering Pi contains the following mapping:
test_snake_in_ggg(x1, x2, x3)  =  test_snake_in_ggg(x1, x2, x3)
U1_ggg(x1, x2, x3, x4)  =  U1_ggg(x1, x3, x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga
s(x1)  =  s(x1)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
U2_ggg(x1, x2, x3, x4, x5)  =  U2_ggg(x1, x5)
U3_ggg(x1, x2, x3, x4)  =  U3_ggg(x4)
snake_in_gaa(x1, x2, x3)  =  snake_in_gaa(x1)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x4)
infinite_snake_in_gaa(x1, x2, x3)  =  infinite_snake_in_gaa(x1)
[]  =  []
infinite_snake_out_gaa(x1, x2, x3)  =  infinite_snake_out_gaa
.(x1, x2)  =  .(x1, x2)
U8_gaa(x1, x2, x3, x4, x5)  =  U8_gaa(x5)
U6_gaa(x1, x2, x3, x4)  =  U6_gaa(x4)
produce_snake_in_aaaa(x1, x2, x3, x4)  =  produce_snake_in_aaaa
produce_snake_out_aaaa(x1, x2, x3, x4)  =  produce_snake_out_aaaa
U9_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U9_aaaa(x7)
part_of_snake_in_aaaa(x1, x2, x3, x4)  =  part_of_snake_in_aaaa
part_of_snake_out_aaaa(x1, x2, x3, x4)  =  part_of_snake_out_aaaa
U11_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U11_aaaa(x7)
U10_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U10_aaaa(x7)
U7_gaa(x1, x2, x3, x4)  =  U7_gaa(x4)
coil_it_in_ag(x1, x2)  =  coil_it_in_ag(x2)
coil_it_out_ag(x1, x2)  =  coil_it_out_ag
odd  =  odd
U12_ag(x1, x2, x3)  =  U12_ag(x3)
even  =  even
U13_ag(x1, x2, x3)  =  U13_ag(x3)
reverse2_in_aa(x1, x2)  =  reverse2_in_aa
U15_aa(x1, x2, x3)  =  U15_aa(x3)
reverse_in_aga(x1, x2, x3)  =  reverse_in_aga(x2)
reverse_out_aga(x1, x2, x3)  =  reverse_out_aga
U16_aga(x1, x2, x3, x4, x5)  =  U16_aga(x5)
reverse_in_aaa(x1, x2, x3)  =  reverse_in_aaa
reverse_out_aaa(x1, x2, x3)  =  reverse_out_aaa
U16_aaa(x1, x2, x3, x4, x5)  =  U16_aaa(x5)
reverse2_out_aa(x1, x2)  =  reverse2_out_aa
U14_ag(x1, x2, x3)  =  U14_ag(x3)
snake_out_gaa(x1, x2, x3)  =  snake_out_gaa
test_snake_out_ggg(x1, x2, x3)  =  test_snake_out_ggg
U14_AG(x1, x2, x3)  =  U14_AG(x3)
S2L_IN_GA(x1, x2)  =  S2L_IN_GA(x1)
TEST_SNAKE_IN_GGG(x1, x2, x3)  =  TEST_SNAKE_IN_GGG(x1, x2, x3)
INFINITE_SNAKE_IN_GAA(x1, x2, x3)  =  INFINITE_SNAKE_IN_GAA(x1)
REVERSE_IN_AGA(x1, x2, x3)  =  REVERSE_IN_AGA(x2)
U1_GGG(x1, x2, x3, x4)  =  U1_GGG(x1, x3, x4)
U4_GA(x1, x2, x3, x4)  =  U4_GA(x4)
U3_GGG(x1, x2, x3, x4)  =  U3_GGG(x4)
REVERSE2_IN_AA(x1, x2)  =  REVERSE2_IN_AA
U16_AGA(x1, x2, x3, x4, x5)  =  U16_AGA(x5)
REVERSE_IN_AAA(x1, x2, x3)  =  REVERSE_IN_AAA
SNAKE_IN_GAA(x1, x2, x3)  =  SNAKE_IN_GAA(x1)
COIL_IT_IN_AG(x1, x2)  =  COIL_IT_IN_AG(x2)
PART_OF_SNAKE_IN_AAAA(x1, x2, x3, x4)  =  PART_OF_SNAKE_IN_AAAA
U9_AAAA(x1, x2, x3, x4, x5, x6, x7)  =  U9_AAAA(x7)
U16_AAA(x1, x2, x3, x4, x5)  =  U16_AAA(x5)
U10_AAAA(x1, x2, x3, x4, x5, x6, x7)  =  U10_AAAA(x7)
U5_GAA(x1, x2, x3, x4)  =  U5_GAA(x4)
U11_AAAA(x1, x2, x3, x4, x5, x6, x7)  =  U11_AAAA(x7)
U8_GAA(x1, x2, x3, x4, x5)  =  U8_GAA(x5)
U13_AG(x1, x2, x3)  =  U13_AG(x3)
U6_GAA(x1, x2, x3, x4)  =  U6_GAA(x4)
PRODUCE_SNAKE_IN_AAAA(x1, x2, x3, x4)  =  PRODUCE_SNAKE_IN_AAAA
U2_GGG(x1, x2, x3, x4, x5)  =  U2_GGG(x1, x5)
U15_AA(x1, x2, x3)  =  U15_AA(x3)
U12_AG(x1, x2, x3)  =  U12_AG(x3)
U7_GAA(x1, x2, x3, x4)  =  U7_GAA(x4)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

TEST_SNAKE_IN_GGG(Pattern, C, R) → U1_GGG(Pattern, C, R, s2l_in_ga(C, Cols))
TEST_SNAKE_IN_GGG(Pattern, C, R) → S2L_IN_GA(C, Cols)
S2L_IN_GA(s(X), .(X1, Y)) → U4_GA(X, X1, Y, s2l_in_ga(X, Y))
S2L_IN_GA(s(X), .(X1, Y)) → S2L_IN_GA(X, Y)
U1_GGG(Pattern, C, R, s2l_out_ga(C, Cols)) → U2_GGG(Pattern, C, R, Cols, s2l_in_ga(R, Rows))
U1_GGG(Pattern, C, R, s2l_out_ga(C, Cols)) → S2L_IN_GA(R, Rows)
U2_GGG(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → U3_GGG(Pattern, C, R, snake_in_gaa(Pattern, Cols, Rows))
U2_GGG(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → SNAKE_IN_GAA(Pattern, Cols, Rows)
SNAKE_IN_GAA(Pattern, Cols, Rows) → U5_GAA(Pattern, Cols, Rows, infinite_snake_in_gaa(Pattern, InfSnake, InfSnake))
SNAKE_IN_GAA(Pattern, Cols, Rows) → INFINITE_SNAKE_IN_GAA(Pattern, InfSnake, InfSnake)
INFINITE_SNAKE_IN_GAA(.(A, R), .(A, T), S) → U8_GAA(A, R, T, S, infinite_snake_in_gaa(R, T, S))
INFINITE_SNAKE_IN_GAA(.(A, R), .(A, T), S) → INFINITE_SNAKE_IN_GAA(R, T, S)
U5_GAA(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → U6_GAA(Pattern, Cols, Rows, produce_snake_in_aaaa(Rows, Cols, InfSnake, Snake))
U5_GAA(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → PRODUCE_SNAKE_IN_AAAA(Rows, Cols, InfSnake, Snake)
PRODUCE_SNAKE_IN_AAAA(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_AAAA(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
PRODUCE_SNAKE_IN_AAAA(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → PART_OF_SNAKE_IN_AAAA(Cols, InfSnake, NewInfSnake, Part)
PART_OF_SNAKE_IN_AAAA(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_AAAA(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
PART_OF_SNAKE_IN_AAAA(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → PART_OF_SNAKE_IN_AAAA(R, Rings, RestSnake, RestRings)
U9_AAAA(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → U10_AAAA(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_in_aaaa(Rows, Cols, NewInfSnake, Tail))
U9_AAAA(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → PRODUCE_SNAKE_IN_AAAA(Rows, Cols, NewInfSnake, Tail)
U6_GAA(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → U7_GAA(Pattern, Cols, Rows, coil_it_in_ag(Snake, odd))
U6_GAA(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → COIL_IT_IN_AG(Snake, odd)
COIL_IT_IN_AG(.(Line, Lines), odd) → U12_AG(Line, Lines, coil_it_in_ag(Lines, even))
COIL_IT_IN_AG(.(Line, Lines), odd) → COIL_IT_IN_AG(Lines, even)
COIL_IT_IN_AG(.(Line, Lines), even) → U13_AG(Line, Lines, reverse2_in_aa(Line, Line1))
COIL_IT_IN_AG(.(Line, Lines), even) → REVERSE2_IN_AA(Line, Line1)
REVERSE2_IN_AA(List, Reversed) → U15_AA(List, Reversed, reverse_in_aga(List, [], Reversed))
REVERSE2_IN_AA(List, Reversed) → REVERSE_IN_AGA(List, [], Reversed)
REVERSE_IN_AGA(.(Head, Tail), SoFar, Reversed) → U16_AGA(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
REVERSE_IN_AGA(.(Head, Tail), SoFar, Reversed) → REVERSE_IN_AAA(Tail, .(Head, SoFar), Reversed)
REVERSE_IN_AAA(.(Head, Tail), SoFar, Reversed) → U16_AAA(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
REVERSE_IN_AAA(.(Head, Tail), SoFar, Reversed) → REVERSE_IN_AAA(Tail, .(Head, SoFar), Reversed)
U13_AG(Line, Lines, reverse2_out_aa(Line, Line1)) → U14_AG(Line, Lines, coil_it_in_ag(Lines, odd))
U13_AG(Line, Lines, reverse2_out_aa(Line, Line1)) → COIL_IT_IN_AG(Lines, odd)

The TRS R consists of the following rules:

test_snake_in_ggg(Pattern, C, R) → U1_ggg(Pattern, C, R, s2l_in_ga(C, Cols))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
s2l_in_ga(s(X), .(X1, Y)) → U4_ga(X, X1, Y, s2l_in_ga(X, Y))
U4_ga(X, X1, Y, s2l_out_ga(X, Y)) → s2l_out_ga(s(X), .(X1, Y))
U1_ggg(Pattern, C, R, s2l_out_ga(C, Cols)) → U2_ggg(Pattern, C, R, Cols, s2l_in_ga(R, Rows))
U2_ggg(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → U3_ggg(Pattern, C, R, snake_in_gaa(Pattern, Cols, Rows))
snake_in_gaa(Pattern, Cols, Rows) → U5_gaa(Pattern, Cols, Rows, infinite_snake_in_gaa(Pattern, InfSnake, InfSnake))
infinite_snake_in_gaa([], S, S) → infinite_snake_out_gaa([], S, S)
infinite_snake_in_gaa(.(A, R), .(A, T), S) → U8_gaa(A, R, T, S, infinite_snake_in_gaa(R, T, S))
U8_gaa(A, R, T, S, infinite_snake_out_gaa(R, T, S)) → infinite_snake_out_gaa(.(A, R), .(A, T), S)
U5_gaa(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → U6_gaa(Pattern, Cols, Rows, produce_snake_in_aaaa(Rows, Cols, InfSnake, Snake))
produce_snake_in_aaaa([], X, X1, []) → produce_snake_out_aaaa([], X, X1, [])
produce_snake_in_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
part_of_snake_in_aaaa([], RestSnake, RestSnake, []) → part_of_snake_out_aaaa([], RestSnake, RestSnake, [])
part_of_snake_in_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_out_aaaa(R, Rings, RestSnake, RestRings)) → part_of_snake_out_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings))
U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_in_aaaa(Rows, Cols, NewInfSnake, Tail))
U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_out_aaaa(Rows, Cols, NewInfSnake, Tail)) → produce_snake_out_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail))
U6_gaa(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → U7_gaa(Pattern, Cols, Rows, coil_it_in_ag(Snake, odd))
coil_it_in_ag([], X) → coil_it_out_ag([], X)
coil_it_in_ag(.(Line, Lines), odd) → U12_ag(Line, Lines, coil_it_in_ag(Lines, even))
coil_it_in_ag(.(Line, Lines), even) → U13_ag(Line, Lines, reverse2_in_aa(Line, Line1))
reverse2_in_aa(List, Reversed) → U15_aa(List, Reversed, reverse_in_aga(List, [], Reversed))
reverse_in_aga([], Reversed, Reversed) → reverse_out_aga([], Reversed, Reversed)
reverse_in_aga(.(Head, Tail), SoFar, Reversed) → U16_aga(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
reverse_in_aaa([], Reversed, Reversed) → reverse_out_aaa([], Reversed, Reversed)
reverse_in_aaa(.(Head, Tail), SoFar, Reversed) → U16_aaa(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
U16_aaa(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aaa(.(Head, Tail), SoFar, Reversed)
U16_aga(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aga(.(Head, Tail), SoFar, Reversed)
U15_aa(List, Reversed, reverse_out_aga(List, [], Reversed)) → reverse2_out_aa(List, Reversed)
U13_ag(Line, Lines, reverse2_out_aa(Line, Line1)) → U14_ag(Line, Lines, coil_it_in_ag(Lines, odd))
U14_ag(Line, Lines, coil_it_out_ag(Lines, odd)) → coil_it_out_ag(.(Line, Lines), even)
U12_ag(Line, Lines, coil_it_out_ag(Lines, even)) → coil_it_out_ag(.(Line, Lines), odd)
U7_gaa(Pattern, Cols, Rows, coil_it_out_ag(Snake, odd)) → snake_out_gaa(Pattern, Cols, Rows)
U3_ggg(Pattern, C, R, snake_out_gaa(Pattern, Cols, Rows)) → test_snake_out_ggg(Pattern, C, R)

The argument filtering Pi contains the following mapping:
test_snake_in_ggg(x1, x2, x3)  =  test_snake_in_ggg(x1, x2, x3)
U1_ggg(x1, x2, x3, x4)  =  U1_ggg(x1, x3, x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga
s(x1)  =  s(x1)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
U2_ggg(x1, x2, x3, x4, x5)  =  U2_ggg(x1, x5)
U3_ggg(x1, x2, x3, x4)  =  U3_ggg(x4)
snake_in_gaa(x1, x2, x3)  =  snake_in_gaa(x1)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x4)
infinite_snake_in_gaa(x1, x2, x3)  =  infinite_snake_in_gaa(x1)
[]  =  []
infinite_snake_out_gaa(x1, x2, x3)  =  infinite_snake_out_gaa
.(x1, x2)  =  .(x1, x2)
U8_gaa(x1, x2, x3, x4, x5)  =  U8_gaa(x5)
U6_gaa(x1, x2, x3, x4)  =  U6_gaa(x4)
produce_snake_in_aaaa(x1, x2, x3, x4)  =  produce_snake_in_aaaa
produce_snake_out_aaaa(x1, x2, x3, x4)  =  produce_snake_out_aaaa
U9_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U9_aaaa(x7)
part_of_snake_in_aaaa(x1, x2, x3, x4)  =  part_of_snake_in_aaaa
part_of_snake_out_aaaa(x1, x2, x3, x4)  =  part_of_snake_out_aaaa
U11_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U11_aaaa(x7)
U10_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U10_aaaa(x7)
U7_gaa(x1, x2, x3, x4)  =  U7_gaa(x4)
coil_it_in_ag(x1, x2)  =  coil_it_in_ag(x2)
coil_it_out_ag(x1, x2)  =  coil_it_out_ag
odd  =  odd
U12_ag(x1, x2, x3)  =  U12_ag(x3)
even  =  even
U13_ag(x1, x2, x3)  =  U13_ag(x3)
reverse2_in_aa(x1, x2)  =  reverse2_in_aa
U15_aa(x1, x2, x3)  =  U15_aa(x3)
reverse_in_aga(x1, x2, x3)  =  reverse_in_aga(x2)
reverse_out_aga(x1, x2, x3)  =  reverse_out_aga
U16_aga(x1, x2, x3, x4, x5)  =  U16_aga(x5)
reverse_in_aaa(x1, x2, x3)  =  reverse_in_aaa
reverse_out_aaa(x1, x2, x3)  =  reverse_out_aaa
U16_aaa(x1, x2, x3, x4, x5)  =  U16_aaa(x5)
reverse2_out_aa(x1, x2)  =  reverse2_out_aa
U14_ag(x1, x2, x3)  =  U14_ag(x3)
snake_out_gaa(x1, x2, x3)  =  snake_out_gaa
test_snake_out_ggg(x1, x2, x3)  =  test_snake_out_ggg
U14_AG(x1, x2, x3)  =  U14_AG(x3)
S2L_IN_GA(x1, x2)  =  S2L_IN_GA(x1)
TEST_SNAKE_IN_GGG(x1, x2, x3)  =  TEST_SNAKE_IN_GGG(x1, x2, x3)
INFINITE_SNAKE_IN_GAA(x1, x2, x3)  =  INFINITE_SNAKE_IN_GAA(x1)
REVERSE_IN_AGA(x1, x2, x3)  =  REVERSE_IN_AGA(x2)
U1_GGG(x1, x2, x3, x4)  =  U1_GGG(x1, x3, x4)
U4_GA(x1, x2, x3, x4)  =  U4_GA(x4)
U3_GGG(x1, x2, x3, x4)  =  U3_GGG(x4)
REVERSE2_IN_AA(x1, x2)  =  REVERSE2_IN_AA
U16_AGA(x1, x2, x3, x4, x5)  =  U16_AGA(x5)
REVERSE_IN_AAA(x1, x2, x3)  =  REVERSE_IN_AAA
SNAKE_IN_GAA(x1, x2, x3)  =  SNAKE_IN_GAA(x1)
COIL_IT_IN_AG(x1, x2)  =  COIL_IT_IN_AG(x2)
PART_OF_SNAKE_IN_AAAA(x1, x2, x3, x4)  =  PART_OF_SNAKE_IN_AAAA
U9_AAAA(x1, x2, x3, x4, x5, x6, x7)  =  U9_AAAA(x7)
U16_AAA(x1, x2, x3, x4, x5)  =  U16_AAA(x5)
U10_AAAA(x1, x2, x3, x4, x5, x6, x7)  =  U10_AAAA(x7)
U5_GAA(x1, x2, x3, x4)  =  U5_GAA(x4)
U11_AAAA(x1, x2, x3, x4, x5, x6, x7)  =  U11_AAAA(x7)
U8_GAA(x1, x2, x3, x4, x5)  =  U8_GAA(x5)
U13_AG(x1, x2, x3)  =  U13_AG(x3)
U6_GAA(x1, x2, x3, x4)  =  U6_GAA(x4)
PRODUCE_SNAKE_IN_AAAA(x1, x2, x3, x4)  =  PRODUCE_SNAKE_IN_AAAA
U2_GGG(x1, x2, x3, x4, x5)  =  U2_GGG(x1, x5)
U15_AA(x1, x2, x3)  =  U15_AA(x3)
U12_AG(x1, x2, x3)  =  U12_AG(x3)
U7_GAA(x1, x2, x3, x4)  =  U7_GAA(x4)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 6 SCCs with 25 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

REVERSE_IN_AAA(.(Head, Tail), SoFar, Reversed) → REVERSE_IN_AAA(Tail, .(Head, SoFar), Reversed)

The TRS R consists of the following rules:

test_snake_in_ggg(Pattern, C, R) → U1_ggg(Pattern, C, R, s2l_in_ga(C, Cols))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
s2l_in_ga(s(X), .(X1, Y)) → U4_ga(X, X1, Y, s2l_in_ga(X, Y))
U4_ga(X, X1, Y, s2l_out_ga(X, Y)) → s2l_out_ga(s(X), .(X1, Y))
U1_ggg(Pattern, C, R, s2l_out_ga(C, Cols)) → U2_ggg(Pattern, C, R, Cols, s2l_in_ga(R, Rows))
U2_ggg(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → U3_ggg(Pattern, C, R, snake_in_gaa(Pattern, Cols, Rows))
snake_in_gaa(Pattern, Cols, Rows) → U5_gaa(Pattern, Cols, Rows, infinite_snake_in_gaa(Pattern, InfSnake, InfSnake))
infinite_snake_in_gaa([], S, S) → infinite_snake_out_gaa([], S, S)
infinite_snake_in_gaa(.(A, R), .(A, T), S) → U8_gaa(A, R, T, S, infinite_snake_in_gaa(R, T, S))
U8_gaa(A, R, T, S, infinite_snake_out_gaa(R, T, S)) → infinite_snake_out_gaa(.(A, R), .(A, T), S)
U5_gaa(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → U6_gaa(Pattern, Cols, Rows, produce_snake_in_aaaa(Rows, Cols, InfSnake, Snake))
produce_snake_in_aaaa([], X, X1, []) → produce_snake_out_aaaa([], X, X1, [])
produce_snake_in_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
part_of_snake_in_aaaa([], RestSnake, RestSnake, []) → part_of_snake_out_aaaa([], RestSnake, RestSnake, [])
part_of_snake_in_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_out_aaaa(R, Rings, RestSnake, RestRings)) → part_of_snake_out_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings))
U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_in_aaaa(Rows, Cols, NewInfSnake, Tail))
U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_out_aaaa(Rows, Cols, NewInfSnake, Tail)) → produce_snake_out_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail))
U6_gaa(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → U7_gaa(Pattern, Cols, Rows, coil_it_in_ag(Snake, odd))
coil_it_in_ag([], X) → coil_it_out_ag([], X)
coil_it_in_ag(.(Line, Lines), odd) → U12_ag(Line, Lines, coil_it_in_ag(Lines, even))
coil_it_in_ag(.(Line, Lines), even) → U13_ag(Line, Lines, reverse2_in_aa(Line, Line1))
reverse2_in_aa(List, Reversed) → U15_aa(List, Reversed, reverse_in_aga(List, [], Reversed))
reverse_in_aga([], Reversed, Reversed) → reverse_out_aga([], Reversed, Reversed)
reverse_in_aga(.(Head, Tail), SoFar, Reversed) → U16_aga(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
reverse_in_aaa([], Reversed, Reversed) → reverse_out_aaa([], Reversed, Reversed)
reverse_in_aaa(.(Head, Tail), SoFar, Reversed) → U16_aaa(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
U16_aaa(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aaa(.(Head, Tail), SoFar, Reversed)
U16_aga(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aga(.(Head, Tail), SoFar, Reversed)
U15_aa(List, Reversed, reverse_out_aga(List, [], Reversed)) → reverse2_out_aa(List, Reversed)
U13_ag(Line, Lines, reverse2_out_aa(Line, Line1)) → U14_ag(Line, Lines, coil_it_in_ag(Lines, odd))
U14_ag(Line, Lines, coil_it_out_ag(Lines, odd)) → coil_it_out_ag(.(Line, Lines), even)
U12_ag(Line, Lines, coil_it_out_ag(Lines, even)) → coil_it_out_ag(.(Line, Lines), odd)
U7_gaa(Pattern, Cols, Rows, coil_it_out_ag(Snake, odd)) → snake_out_gaa(Pattern, Cols, Rows)
U3_ggg(Pattern, C, R, snake_out_gaa(Pattern, Cols, Rows)) → test_snake_out_ggg(Pattern, C, R)

The argument filtering Pi contains the following mapping:
test_snake_in_ggg(x1, x2, x3)  =  test_snake_in_ggg(x1, x2, x3)
U1_ggg(x1, x2, x3, x4)  =  U1_ggg(x1, x3, x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga
s(x1)  =  s(x1)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
U2_ggg(x1, x2, x3, x4, x5)  =  U2_ggg(x1, x5)
U3_ggg(x1, x2, x3, x4)  =  U3_ggg(x4)
snake_in_gaa(x1, x2, x3)  =  snake_in_gaa(x1)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x4)
infinite_snake_in_gaa(x1, x2, x3)  =  infinite_snake_in_gaa(x1)
[]  =  []
infinite_snake_out_gaa(x1, x2, x3)  =  infinite_snake_out_gaa
.(x1, x2)  =  .(x1, x2)
U8_gaa(x1, x2, x3, x4, x5)  =  U8_gaa(x5)
U6_gaa(x1, x2, x3, x4)  =  U6_gaa(x4)
produce_snake_in_aaaa(x1, x2, x3, x4)  =  produce_snake_in_aaaa
produce_snake_out_aaaa(x1, x2, x3, x4)  =  produce_snake_out_aaaa
U9_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U9_aaaa(x7)
part_of_snake_in_aaaa(x1, x2, x3, x4)  =  part_of_snake_in_aaaa
part_of_snake_out_aaaa(x1, x2, x3, x4)  =  part_of_snake_out_aaaa
U11_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U11_aaaa(x7)
U10_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U10_aaaa(x7)
U7_gaa(x1, x2, x3, x4)  =  U7_gaa(x4)
coil_it_in_ag(x1, x2)  =  coil_it_in_ag(x2)
coil_it_out_ag(x1, x2)  =  coil_it_out_ag
odd  =  odd
U12_ag(x1, x2, x3)  =  U12_ag(x3)
even  =  even
U13_ag(x1, x2, x3)  =  U13_ag(x3)
reverse2_in_aa(x1, x2)  =  reverse2_in_aa
U15_aa(x1, x2, x3)  =  U15_aa(x3)
reverse_in_aga(x1, x2, x3)  =  reverse_in_aga(x2)
reverse_out_aga(x1, x2, x3)  =  reverse_out_aga
U16_aga(x1, x2, x3, x4, x5)  =  U16_aga(x5)
reverse_in_aaa(x1, x2, x3)  =  reverse_in_aaa
reverse_out_aaa(x1, x2, x3)  =  reverse_out_aaa
U16_aaa(x1, x2, x3, x4, x5)  =  U16_aaa(x5)
reverse2_out_aa(x1, x2)  =  reverse2_out_aa
U14_ag(x1, x2, x3)  =  U14_ag(x3)
snake_out_gaa(x1, x2, x3)  =  snake_out_gaa
test_snake_out_ggg(x1, x2, x3)  =  test_snake_out_ggg
REVERSE_IN_AAA(x1, x2, x3)  =  REVERSE_IN_AAA

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

REVERSE_IN_AAA(.(Head, Tail), SoFar, Reversed) → REVERSE_IN_AAA(Tail, .(Head, SoFar), Reversed)

R is empty.
The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x1, x2)
REVERSE_IN_AAA(x1, x2, x3)  =  REVERSE_IN_AAA

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ NonTerminationProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

REVERSE_IN_AAAREVERSE_IN_AAA

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
We used the non-termination processor [17] to show that the DP problem is infinite.
Found a loop by semiunifying a rule from P directly.

The TRS P consists of the following rules:

REVERSE_IN_AAAREVERSE_IN_AAA

The TRS R consists of the following rules:none


s = REVERSE_IN_AAA evaluates to t =REVERSE_IN_AAA

Thus s starts an infinite chain as s semiunifies with t with the following substitutions:




Rewriting sequence

The DP semiunifies directly so there is only one rewrite step from REVERSE_IN_AAA to REVERSE_IN_AAA.





↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

COIL_IT_IN_AG(.(Line, Lines), odd) → COIL_IT_IN_AG(Lines, even)
COIL_IT_IN_AG(.(Line, Lines), even) → U13_AG(Line, Lines, reverse2_in_aa(Line, Line1))
U13_AG(Line, Lines, reverse2_out_aa(Line, Line1)) → COIL_IT_IN_AG(Lines, odd)

The TRS R consists of the following rules:

test_snake_in_ggg(Pattern, C, R) → U1_ggg(Pattern, C, R, s2l_in_ga(C, Cols))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
s2l_in_ga(s(X), .(X1, Y)) → U4_ga(X, X1, Y, s2l_in_ga(X, Y))
U4_ga(X, X1, Y, s2l_out_ga(X, Y)) → s2l_out_ga(s(X), .(X1, Y))
U1_ggg(Pattern, C, R, s2l_out_ga(C, Cols)) → U2_ggg(Pattern, C, R, Cols, s2l_in_ga(R, Rows))
U2_ggg(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → U3_ggg(Pattern, C, R, snake_in_gaa(Pattern, Cols, Rows))
snake_in_gaa(Pattern, Cols, Rows) → U5_gaa(Pattern, Cols, Rows, infinite_snake_in_gaa(Pattern, InfSnake, InfSnake))
infinite_snake_in_gaa([], S, S) → infinite_snake_out_gaa([], S, S)
infinite_snake_in_gaa(.(A, R), .(A, T), S) → U8_gaa(A, R, T, S, infinite_snake_in_gaa(R, T, S))
U8_gaa(A, R, T, S, infinite_snake_out_gaa(R, T, S)) → infinite_snake_out_gaa(.(A, R), .(A, T), S)
U5_gaa(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → U6_gaa(Pattern, Cols, Rows, produce_snake_in_aaaa(Rows, Cols, InfSnake, Snake))
produce_snake_in_aaaa([], X, X1, []) → produce_snake_out_aaaa([], X, X1, [])
produce_snake_in_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
part_of_snake_in_aaaa([], RestSnake, RestSnake, []) → part_of_snake_out_aaaa([], RestSnake, RestSnake, [])
part_of_snake_in_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_out_aaaa(R, Rings, RestSnake, RestRings)) → part_of_snake_out_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings))
U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_in_aaaa(Rows, Cols, NewInfSnake, Tail))
U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_out_aaaa(Rows, Cols, NewInfSnake, Tail)) → produce_snake_out_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail))
U6_gaa(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → U7_gaa(Pattern, Cols, Rows, coil_it_in_ag(Snake, odd))
coil_it_in_ag([], X) → coil_it_out_ag([], X)
coil_it_in_ag(.(Line, Lines), odd) → U12_ag(Line, Lines, coil_it_in_ag(Lines, even))
coil_it_in_ag(.(Line, Lines), even) → U13_ag(Line, Lines, reverse2_in_aa(Line, Line1))
reverse2_in_aa(List, Reversed) → U15_aa(List, Reversed, reverse_in_aga(List, [], Reversed))
reverse_in_aga([], Reversed, Reversed) → reverse_out_aga([], Reversed, Reversed)
reverse_in_aga(.(Head, Tail), SoFar, Reversed) → U16_aga(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
reverse_in_aaa([], Reversed, Reversed) → reverse_out_aaa([], Reversed, Reversed)
reverse_in_aaa(.(Head, Tail), SoFar, Reversed) → U16_aaa(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
U16_aaa(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aaa(.(Head, Tail), SoFar, Reversed)
U16_aga(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aga(.(Head, Tail), SoFar, Reversed)
U15_aa(List, Reversed, reverse_out_aga(List, [], Reversed)) → reverse2_out_aa(List, Reversed)
U13_ag(Line, Lines, reverse2_out_aa(Line, Line1)) → U14_ag(Line, Lines, coil_it_in_ag(Lines, odd))
U14_ag(Line, Lines, coil_it_out_ag(Lines, odd)) → coil_it_out_ag(.(Line, Lines), even)
U12_ag(Line, Lines, coil_it_out_ag(Lines, even)) → coil_it_out_ag(.(Line, Lines), odd)
U7_gaa(Pattern, Cols, Rows, coil_it_out_ag(Snake, odd)) → snake_out_gaa(Pattern, Cols, Rows)
U3_ggg(Pattern, C, R, snake_out_gaa(Pattern, Cols, Rows)) → test_snake_out_ggg(Pattern, C, R)

The argument filtering Pi contains the following mapping:
test_snake_in_ggg(x1, x2, x3)  =  test_snake_in_ggg(x1, x2, x3)
U1_ggg(x1, x2, x3, x4)  =  U1_ggg(x1, x3, x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga
s(x1)  =  s(x1)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
U2_ggg(x1, x2, x3, x4, x5)  =  U2_ggg(x1, x5)
U3_ggg(x1, x2, x3, x4)  =  U3_ggg(x4)
snake_in_gaa(x1, x2, x3)  =  snake_in_gaa(x1)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x4)
infinite_snake_in_gaa(x1, x2, x3)  =  infinite_snake_in_gaa(x1)
[]  =  []
infinite_snake_out_gaa(x1, x2, x3)  =  infinite_snake_out_gaa
.(x1, x2)  =  .(x1, x2)
U8_gaa(x1, x2, x3, x4, x5)  =  U8_gaa(x5)
U6_gaa(x1, x2, x3, x4)  =  U6_gaa(x4)
produce_snake_in_aaaa(x1, x2, x3, x4)  =  produce_snake_in_aaaa
produce_snake_out_aaaa(x1, x2, x3, x4)  =  produce_snake_out_aaaa
U9_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U9_aaaa(x7)
part_of_snake_in_aaaa(x1, x2, x3, x4)  =  part_of_snake_in_aaaa
part_of_snake_out_aaaa(x1, x2, x3, x4)  =  part_of_snake_out_aaaa
U11_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U11_aaaa(x7)
U10_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U10_aaaa(x7)
U7_gaa(x1, x2, x3, x4)  =  U7_gaa(x4)
coil_it_in_ag(x1, x2)  =  coil_it_in_ag(x2)
coil_it_out_ag(x1, x2)  =  coil_it_out_ag
odd  =  odd
U12_ag(x1, x2, x3)  =  U12_ag(x3)
even  =  even
U13_ag(x1, x2, x3)  =  U13_ag(x3)
reverse2_in_aa(x1, x2)  =  reverse2_in_aa
U15_aa(x1, x2, x3)  =  U15_aa(x3)
reverse_in_aga(x1, x2, x3)  =  reverse_in_aga(x2)
reverse_out_aga(x1, x2, x3)  =  reverse_out_aga
U16_aga(x1, x2, x3, x4, x5)  =  U16_aga(x5)
reverse_in_aaa(x1, x2, x3)  =  reverse_in_aaa
reverse_out_aaa(x1, x2, x3)  =  reverse_out_aaa
U16_aaa(x1, x2, x3, x4, x5)  =  U16_aaa(x5)
reverse2_out_aa(x1, x2)  =  reverse2_out_aa
U14_ag(x1, x2, x3)  =  U14_ag(x3)
snake_out_gaa(x1, x2, x3)  =  snake_out_gaa
test_snake_out_ggg(x1, x2, x3)  =  test_snake_out_ggg
COIL_IT_IN_AG(x1, x2)  =  COIL_IT_IN_AG(x2)
U13_AG(x1, x2, x3)  =  U13_AG(x3)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

COIL_IT_IN_AG(.(Line, Lines), odd) → COIL_IT_IN_AG(Lines, even)
COIL_IT_IN_AG(.(Line, Lines), even) → U13_AG(Line, Lines, reverse2_in_aa(Line, Line1))
U13_AG(Line, Lines, reverse2_out_aa(Line, Line1)) → COIL_IT_IN_AG(Lines, odd)

The TRS R consists of the following rules:

reverse2_in_aa(List, Reversed) → U15_aa(List, Reversed, reverse_in_aga(List, [], Reversed))
U15_aa(List, Reversed, reverse_out_aga(List, [], Reversed)) → reverse2_out_aa(List, Reversed)
reverse_in_aga([], Reversed, Reversed) → reverse_out_aga([], Reversed, Reversed)
reverse_in_aga(.(Head, Tail), SoFar, Reversed) → U16_aga(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
U16_aga(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aga(.(Head, Tail), SoFar, Reversed)
reverse_in_aaa([], Reversed, Reversed) → reverse_out_aaa([], Reversed, Reversed)
reverse_in_aaa(.(Head, Tail), SoFar, Reversed) → U16_aaa(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
U16_aaa(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aaa(.(Head, Tail), SoFar, Reversed)

The argument filtering Pi contains the following mapping:
[]  =  []
.(x1, x2)  =  .(x1, x2)
odd  =  odd
even  =  even
reverse2_in_aa(x1, x2)  =  reverse2_in_aa
U15_aa(x1, x2, x3)  =  U15_aa(x3)
reverse_in_aga(x1, x2, x3)  =  reverse_in_aga(x2)
reverse_out_aga(x1, x2, x3)  =  reverse_out_aga
U16_aga(x1, x2, x3, x4, x5)  =  U16_aga(x5)
reverse_in_aaa(x1, x2, x3)  =  reverse_in_aaa
reverse_out_aaa(x1, x2, x3)  =  reverse_out_aaa
U16_aaa(x1, x2, x3, x4, x5)  =  U16_aaa(x5)
reverse2_out_aa(x1, x2)  =  reverse2_out_aa
COIL_IT_IN_AG(x1, x2)  =  COIL_IT_IN_AG(x2)
U13_AG(x1, x2, x3)  =  U13_AG(x3)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ Narrowing
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

COIL_IT_IN_AG(odd) → COIL_IT_IN_AG(even)
COIL_IT_IN_AG(even) → U13_AG(reverse2_in_aa)
U13_AG(reverse2_out_aa) → COIL_IT_IN_AG(odd)

The TRS R consists of the following rules:

reverse2_in_aaU15_aa(reverse_in_aga([]))
U15_aa(reverse_out_aga) → reverse2_out_aa
reverse_in_aga(Reversed) → reverse_out_aga
reverse_in_aga(SoFar) → U16_aga(reverse_in_aaa)
U16_aga(reverse_out_aaa) → reverse_out_aga
reverse_in_aaareverse_out_aaa
reverse_in_aaaU16_aaa(reverse_in_aaa)
U16_aaa(reverse_out_aaa) → reverse_out_aaa

The set Q consists of the following terms:

reverse2_in_aa
U15_aa(x0)
reverse_in_aga(x0)
U16_aga(x0)
reverse_in_aaa
U16_aaa(x0)

We have to consider all (P,Q,R)-chains.
By narrowing [15] the rule COIL_IT_IN_AG(even) → U13_AG(reverse2_in_aa) at position [0] we obtained the following new rules:

COIL_IT_IN_AG(even) → U13_AG(U15_aa(reverse_in_aga([])))



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ Narrowing
QDP
                            ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

COIL_IT_IN_AG(odd) → COIL_IT_IN_AG(even)
COIL_IT_IN_AG(even) → U13_AG(U15_aa(reverse_in_aga([])))
U13_AG(reverse2_out_aa) → COIL_IT_IN_AG(odd)

The TRS R consists of the following rules:

reverse2_in_aaU15_aa(reverse_in_aga([]))
U15_aa(reverse_out_aga) → reverse2_out_aa
reverse_in_aga(Reversed) → reverse_out_aga
reverse_in_aga(SoFar) → U16_aga(reverse_in_aaa)
U16_aga(reverse_out_aaa) → reverse_out_aga
reverse_in_aaareverse_out_aaa
reverse_in_aaaU16_aaa(reverse_in_aaa)
U16_aaa(reverse_out_aaa) → reverse_out_aaa

The set Q consists of the following terms:

reverse2_in_aa
U15_aa(x0)
reverse_in_aga(x0)
U16_aga(x0)
reverse_in_aaa
U16_aaa(x0)

We have to consider all (P,Q,R)-chains.
As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [15] we can delete all non-usable rules [17] from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ Narrowing
                          ↳ QDP
                            ↳ UsableRulesProof
QDP
                                ↳ QReductionProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

COIL_IT_IN_AG(odd) → COIL_IT_IN_AG(even)
COIL_IT_IN_AG(even) → U13_AG(U15_aa(reverse_in_aga([])))
U13_AG(reverse2_out_aa) → COIL_IT_IN_AG(odd)

The TRS R consists of the following rules:

reverse_in_aga(Reversed) → reverse_out_aga
reverse_in_aga(SoFar) → U16_aga(reverse_in_aaa)
U15_aa(reverse_out_aga) → reverse2_out_aa
reverse_in_aaareverse_out_aaa
reverse_in_aaaU16_aaa(reverse_in_aaa)
U16_aga(reverse_out_aaa) → reverse_out_aga
U16_aaa(reverse_out_aaa) → reverse_out_aaa

The set Q consists of the following terms:

reverse2_in_aa
U15_aa(x0)
reverse_in_aga(x0)
U16_aga(x0)
reverse_in_aaa
U16_aaa(x0)

We have to consider all (P,Q,R)-chains.
We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.

reverse2_in_aa



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ Narrowing
                          ↳ QDP
                            ↳ UsableRulesProof
                              ↳ QDP
                                ↳ QReductionProof
QDP
                                    ↳ NonTerminationProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

COIL_IT_IN_AG(odd) → COIL_IT_IN_AG(even)
COIL_IT_IN_AG(even) → U13_AG(U15_aa(reverse_in_aga([])))
U13_AG(reverse2_out_aa) → COIL_IT_IN_AG(odd)

The TRS R consists of the following rules:

reverse_in_aga(Reversed) → reverse_out_aga
reverse_in_aga(SoFar) → U16_aga(reverse_in_aaa)
U15_aa(reverse_out_aga) → reverse2_out_aa
reverse_in_aaareverse_out_aaa
reverse_in_aaaU16_aaa(reverse_in_aaa)
U16_aga(reverse_out_aaa) → reverse_out_aga
U16_aaa(reverse_out_aaa) → reverse_out_aaa

The set Q consists of the following terms:

U15_aa(x0)
reverse_in_aga(x0)
U16_aga(x0)
reverse_in_aaa
U16_aaa(x0)

We have to consider all (P,Q,R)-chains.
We used the non-termination processor [17] to show that the DP problem is infinite.
Found a loop by narrowing to the left:

The TRS P consists of the following rules:

COIL_IT_IN_AG(odd) → COIL_IT_IN_AG(even)
COIL_IT_IN_AG(even) → U13_AG(U15_aa(reverse_in_aga([])))
U13_AG(reverse2_out_aa) → COIL_IT_IN_AG(odd)

The TRS R consists of the following rules:

reverse_in_aga(Reversed) → reverse_out_aga
reverse_in_aga(SoFar) → U16_aga(reverse_in_aaa)
U15_aa(reverse_out_aga) → reverse2_out_aa
reverse_in_aaareverse_out_aaa
reverse_in_aaaU16_aaa(reverse_in_aaa)
U16_aga(reverse_out_aaa) → reverse_out_aga
U16_aaa(reverse_out_aaa) → reverse_out_aaa


s = U13_AG(U15_aa(reverse_in_aga(Reversed))) evaluates to t =U13_AG(U15_aa(reverse_in_aga([])))

Thus s starts an infinite chain as s semiunifies with t with the following substitutions:




Rewriting sequence

U13_AG(U15_aa(reverse_in_aga(Reversed)))U13_AG(U15_aa(reverse_out_aga))
with rule reverse_in_aga(Reversed') → reverse_out_aga at position [0,0] and matcher [Reversed' / Reversed]

U13_AG(U15_aa(reverse_out_aga))U13_AG(reverse2_out_aa)
with rule U15_aa(reverse_out_aga) → reverse2_out_aa at position [0] and matcher [ ]

U13_AG(reverse2_out_aa)COIL_IT_IN_AG(odd)
with rule U13_AG(reverse2_out_aa) → COIL_IT_IN_AG(odd) at position [] and matcher [ ]

COIL_IT_IN_AG(odd)COIL_IT_IN_AG(even)
with rule COIL_IT_IN_AG(odd) → COIL_IT_IN_AG(even) at position [] and matcher [ ]

COIL_IT_IN_AG(even)U13_AG(U15_aa(reverse_in_aga([])))
with rule COIL_IT_IN_AG(even) → U13_AG(U15_aa(reverse_in_aga([])))

Now applying the matcher to the start term leads to a term which is equal to the last term in the rewriting sequence


All these steps are and every following step will be a correct step w.r.t to Q.





↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

PART_OF_SNAKE_IN_AAAA(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → PART_OF_SNAKE_IN_AAAA(R, Rings, RestSnake, RestRings)

The TRS R consists of the following rules:

test_snake_in_ggg(Pattern, C, R) → U1_ggg(Pattern, C, R, s2l_in_ga(C, Cols))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
s2l_in_ga(s(X), .(X1, Y)) → U4_ga(X, X1, Y, s2l_in_ga(X, Y))
U4_ga(X, X1, Y, s2l_out_ga(X, Y)) → s2l_out_ga(s(X), .(X1, Y))
U1_ggg(Pattern, C, R, s2l_out_ga(C, Cols)) → U2_ggg(Pattern, C, R, Cols, s2l_in_ga(R, Rows))
U2_ggg(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → U3_ggg(Pattern, C, R, snake_in_gaa(Pattern, Cols, Rows))
snake_in_gaa(Pattern, Cols, Rows) → U5_gaa(Pattern, Cols, Rows, infinite_snake_in_gaa(Pattern, InfSnake, InfSnake))
infinite_snake_in_gaa([], S, S) → infinite_snake_out_gaa([], S, S)
infinite_snake_in_gaa(.(A, R), .(A, T), S) → U8_gaa(A, R, T, S, infinite_snake_in_gaa(R, T, S))
U8_gaa(A, R, T, S, infinite_snake_out_gaa(R, T, S)) → infinite_snake_out_gaa(.(A, R), .(A, T), S)
U5_gaa(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → U6_gaa(Pattern, Cols, Rows, produce_snake_in_aaaa(Rows, Cols, InfSnake, Snake))
produce_snake_in_aaaa([], X, X1, []) → produce_snake_out_aaaa([], X, X1, [])
produce_snake_in_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
part_of_snake_in_aaaa([], RestSnake, RestSnake, []) → part_of_snake_out_aaaa([], RestSnake, RestSnake, [])
part_of_snake_in_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_out_aaaa(R, Rings, RestSnake, RestRings)) → part_of_snake_out_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings))
U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_in_aaaa(Rows, Cols, NewInfSnake, Tail))
U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_out_aaaa(Rows, Cols, NewInfSnake, Tail)) → produce_snake_out_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail))
U6_gaa(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → U7_gaa(Pattern, Cols, Rows, coil_it_in_ag(Snake, odd))
coil_it_in_ag([], X) → coil_it_out_ag([], X)
coil_it_in_ag(.(Line, Lines), odd) → U12_ag(Line, Lines, coil_it_in_ag(Lines, even))
coil_it_in_ag(.(Line, Lines), even) → U13_ag(Line, Lines, reverse2_in_aa(Line, Line1))
reverse2_in_aa(List, Reversed) → U15_aa(List, Reversed, reverse_in_aga(List, [], Reversed))
reverse_in_aga([], Reversed, Reversed) → reverse_out_aga([], Reversed, Reversed)
reverse_in_aga(.(Head, Tail), SoFar, Reversed) → U16_aga(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
reverse_in_aaa([], Reversed, Reversed) → reverse_out_aaa([], Reversed, Reversed)
reverse_in_aaa(.(Head, Tail), SoFar, Reversed) → U16_aaa(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
U16_aaa(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aaa(.(Head, Tail), SoFar, Reversed)
U16_aga(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aga(.(Head, Tail), SoFar, Reversed)
U15_aa(List, Reversed, reverse_out_aga(List, [], Reversed)) → reverse2_out_aa(List, Reversed)
U13_ag(Line, Lines, reverse2_out_aa(Line, Line1)) → U14_ag(Line, Lines, coil_it_in_ag(Lines, odd))
U14_ag(Line, Lines, coil_it_out_ag(Lines, odd)) → coil_it_out_ag(.(Line, Lines), even)
U12_ag(Line, Lines, coil_it_out_ag(Lines, even)) → coil_it_out_ag(.(Line, Lines), odd)
U7_gaa(Pattern, Cols, Rows, coil_it_out_ag(Snake, odd)) → snake_out_gaa(Pattern, Cols, Rows)
U3_ggg(Pattern, C, R, snake_out_gaa(Pattern, Cols, Rows)) → test_snake_out_ggg(Pattern, C, R)

The argument filtering Pi contains the following mapping:
test_snake_in_ggg(x1, x2, x3)  =  test_snake_in_ggg(x1, x2, x3)
U1_ggg(x1, x2, x3, x4)  =  U1_ggg(x1, x3, x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga
s(x1)  =  s(x1)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
U2_ggg(x1, x2, x3, x4, x5)  =  U2_ggg(x1, x5)
U3_ggg(x1, x2, x3, x4)  =  U3_ggg(x4)
snake_in_gaa(x1, x2, x3)  =  snake_in_gaa(x1)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x4)
infinite_snake_in_gaa(x1, x2, x3)  =  infinite_snake_in_gaa(x1)
[]  =  []
infinite_snake_out_gaa(x1, x2, x3)  =  infinite_snake_out_gaa
.(x1, x2)  =  .(x1, x2)
U8_gaa(x1, x2, x3, x4, x5)  =  U8_gaa(x5)
U6_gaa(x1, x2, x3, x4)  =  U6_gaa(x4)
produce_snake_in_aaaa(x1, x2, x3, x4)  =  produce_snake_in_aaaa
produce_snake_out_aaaa(x1, x2, x3, x4)  =  produce_snake_out_aaaa
U9_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U9_aaaa(x7)
part_of_snake_in_aaaa(x1, x2, x3, x4)  =  part_of_snake_in_aaaa
part_of_snake_out_aaaa(x1, x2, x3, x4)  =  part_of_snake_out_aaaa
U11_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U11_aaaa(x7)
U10_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U10_aaaa(x7)
U7_gaa(x1, x2, x3, x4)  =  U7_gaa(x4)
coil_it_in_ag(x1, x2)  =  coil_it_in_ag(x2)
coil_it_out_ag(x1, x2)  =  coil_it_out_ag
odd  =  odd
U12_ag(x1, x2, x3)  =  U12_ag(x3)
even  =  even
U13_ag(x1, x2, x3)  =  U13_ag(x3)
reverse2_in_aa(x1, x2)  =  reverse2_in_aa
U15_aa(x1, x2, x3)  =  U15_aa(x3)
reverse_in_aga(x1, x2, x3)  =  reverse_in_aga(x2)
reverse_out_aga(x1, x2, x3)  =  reverse_out_aga
U16_aga(x1, x2, x3, x4, x5)  =  U16_aga(x5)
reverse_in_aaa(x1, x2, x3)  =  reverse_in_aaa
reverse_out_aaa(x1, x2, x3)  =  reverse_out_aaa
U16_aaa(x1, x2, x3, x4, x5)  =  U16_aaa(x5)
reverse2_out_aa(x1, x2)  =  reverse2_out_aa
U14_ag(x1, x2, x3)  =  U14_ag(x3)
snake_out_gaa(x1, x2, x3)  =  snake_out_gaa
test_snake_out_ggg(x1, x2, x3)  =  test_snake_out_ggg
PART_OF_SNAKE_IN_AAAA(x1, x2, x3, x4)  =  PART_OF_SNAKE_IN_AAAA

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

PART_OF_SNAKE_IN_AAAA(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → PART_OF_SNAKE_IN_AAAA(R, Rings, RestSnake, RestRings)

R is empty.
The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x1, x2)
PART_OF_SNAKE_IN_AAAA(x1, x2, x3, x4)  =  PART_OF_SNAKE_IN_AAAA

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ NonTerminationProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

PART_OF_SNAKE_IN_AAAAPART_OF_SNAKE_IN_AAAA

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
We used the non-termination processor [17] to show that the DP problem is infinite.
Found a loop by semiunifying a rule from P directly.

The TRS P consists of the following rules:

PART_OF_SNAKE_IN_AAAAPART_OF_SNAKE_IN_AAAA

The TRS R consists of the following rules:none


s = PART_OF_SNAKE_IN_AAAA evaluates to t =PART_OF_SNAKE_IN_AAAA

Thus s starts an infinite chain as s semiunifies with t with the following substitutions:




Rewriting sequence

The DP semiunifies directly so there is only one rewrite step from PART_OF_SNAKE_IN_AAAA to PART_OF_SNAKE_IN_AAAA.





↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

PRODUCE_SNAKE_IN_AAAA(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_AAAA(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
U9_AAAA(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → PRODUCE_SNAKE_IN_AAAA(Rows, Cols, NewInfSnake, Tail)

The TRS R consists of the following rules:

test_snake_in_ggg(Pattern, C, R) → U1_ggg(Pattern, C, R, s2l_in_ga(C, Cols))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
s2l_in_ga(s(X), .(X1, Y)) → U4_ga(X, X1, Y, s2l_in_ga(X, Y))
U4_ga(X, X1, Y, s2l_out_ga(X, Y)) → s2l_out_ga(s(X), .(X1, Y))
U1_ggg(Pattern, C, R, s2l_out_ga(C, Cols)) → U2_ggg(Pattern, C, R, Cols, s2l_in_ga(R, Rows))
U2_ggg(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → U3_ggg(Pattern, C, R, snake_in_gaa(Pattern, Cols, Rows))
snake_in_gaa(Pattern, Cols, Rows) → U5_gaa(Pattern, Cols, Rows, infinite_snake_in_gaa(Pattern, InfSnake, InfSnake))
infinite_snake_in_gaa([], S, S) → infinite_snake_out_gaa([], S, S)
infinite_snake_in_gaa(.(A, R), .(A, T), S) → U8_gaa(A, R, T, S, infinite_snake_in_gaa(R, T, S))
U8_gaa(A, R, T, S, infinite_snake_out_gaa(R, T, S)) → infinite_snake_out_gaa(.(A, R), .(A, T), S)
U5_gaa(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → U6_gaa(Pattern, Cols, Rows, produce_snake_in_aaaa(Rows, Cols, InfSnake, Snake))
produce_snake_in_aaaa([], X, X1, []) → produce_snake_out_aaaa([], X, X1, [])
produce_snake_in_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
part_of_snake_in_aaaa([], RestSnake, RestSnake, []) → part_of_snake_out_aaaa([], RestSnake, RestSnake, [])
part_of_snake_in_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_out_aaaa(R, Rings, RestSnake, RestRings)) → part_of_snake_out_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings))
U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_in_aaaa(Rows, Cols, NewInfSnake, Tail))
U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_out_aaaa(Rows, Cols, NewInfSnake, Tail)) → produce_snake_out_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail))
U6_gaa(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → U7_gaa(Pattern, Cols, Rows, coil_it_in_ag(Snake, odd))
coil_it_in_ag([], X) → coil_it_out_ag([], X)
coil_it_in_ag(.(Line, Lines), odd) → U12_ag(Line, Lines, coil_it_in_ag(Lines, even))
coil_it_in_ag(.(Line, Lines), even) → U13_ag(Line, Lines, reverse2_in_aa(Line, Line1))
reverse2_in_aa(List, Reversed) → U15_aa(List, Reversed, reverse_in_aga(List, [], Reversed))
reverse_in_aga([], Reversed, Reversed) → reverse_out_aga([], Reversed, Reversed)
reverse_in_aga(.(Head, Tail), SoFar, Reversed) → U16_aga(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
reverse_in_aaa([], Reversed, Reversed) → reverse_out_aaa([], Reversed, Reversed)
reverse_in_aaa(.(Head, Tail), SoFar, Reversed) → U16_aaa(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
U16_aaa(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aaa(.(Head, Tail), SoFar, Reversed)
U16_aga(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aga(.(Head, Tail), SoFar, Reversed)
U15_aa(List, Reversed, reverse_out_aga(List, [], Reversed)) → reverse2_out_aa(List, Reversed)
U13_ag(Line, Lines, reverse2_out_aa(Line, Line1)) → U14_ag(Line, Lines, coil_it_in_ag(Lines, odd))
U14_ag(Line, Lines, coil_it_out_ag(Lines, odd)) → coil_it_out_ag(.(Line, Lines), even)
U12_ag(Line, Lines, coil_it_out_ag(Lines, even)) → coil_it_out_ag(.(Line, Lines), odd)
U7_gaa(Pattern, Cols, Rows, coil_it_out_ag(Snake, odd)) → snake_out_gaa(Pattern, Cols, Rows)
U3_ggg(Pattern, C, R, snake_out_gaa(Pattern, Cols, Rows)) → test_snake_out_ggg(Pattern, C, R)

The argument filtering Pi contains the following mapping:
test_snake_in_ggg(x1, x2, x3)  =  test_snake_in_ggg(x1, x2, x3)
U1_ggg(x1, x2, x3, x4)  =  U1_ggg(x1, x3, x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga
s(x1)  =  s(x1)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
U2_ggg(x1, x2, x3, x4, x5)  =  U2_ggg(x1, x5)
U3_ggg(x1, x2, x3, x4)  =  U3_ggg(x4)
snake_in_gaa(x1, x2, x3)  =  snake_in_gaa(x1)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x4)
infinite_snake_in_gaa(x1, x2, x3)  =  infinite_snake_in_gaa(x1)
[]  =  []
infinite_snake_out_gaa(x1, x2, x3)  =  infinite_snake_out_gaa
.(x1, x2)  =  .(x1, x2)
U8_gaa(x1, x2, x3, x4, x5)  =  U8_gaa(x5)
U6_gaa(x1, x2, x3, x4)  =  U6_gaa(x4)
produce_snake_in_aaaa(x1, x2, x3, x4)  =  produce_snake_in_aaaa
produce_snake_out_aaaa(x1, x2, x3, x4)  =  produce_snake_out_aaaa
U9_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U9_aaaa(x7)
part_of_snake_in_aaaa(x1, x2, x3, x4)  =  part_of_snake_in_aaaa
part_of_snake_out_aaaa(x1, x2, x3, x4)  =  part_of_snake_out_aaaa
U11_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U11_aaaa(x7)
U10_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U10_aaaa(x7)
U7_gaa(x1, x2, x3, x4)  =  U7_gaa(x4)
coil_it_in_ag(x1, x2)  =  coil_it_in_ag(x2)
coil_it_out_ag(x1, x2)  =  coil_it_out_ag
odd  =  odd
U12_ag(x1, x2, x3)  =  U12_ag(x3)
even  =  even
U13_ag(x1, x2, x3)  =  U13_ag(x3)
reverse2_in_aa(x1, x2)  =  reverse2_in_aa
U15_aa(x1, x2, x3)  =  U15_aa(x3)
reverse_in_aga(x1, x2, x3)  =  reverse_in_aga(x2)
reverse_out_aga(x1, x2, x3)  =  reverse_out_aga
U16_aga(x1, x2, x3, x4, x5)  =  U16_aga(x5)
reverse_in_aaa(x1, x2, x3)  =  reverse_in_aaa
reverse_out_aaa(x1, x2, x3)  =  reverse_out_aaa
U16_aaa(x1, x2, x3, x4, x5)  =  U16_aaa(x5)
reverse2_out_aa(x1, x2)  =  reverse2_out_aa
U14_ag(x1, x2, x3)  =  U14_ag(x3)
snake_out_gaa(x1, x2, x3)  =  snake_out_gaa
test_snake_out_ggg(x1, x2, x3)  =  test_snake_out_ggg
U9_AAAA(x1, x2, x3, x4, x5, x6, x7)  =  U9_AAAA(x7)
PRODUCE_SNAKE_IN_AAAA(x1, x2, x3, x4)  =  PRODUCE_SNAKE_IN_AAAA

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

PRODUCE_SNAKE_IN_AAAA(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_AAAA(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
U9_AAAA(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → PRODUCE_SNAKE_IN_AAAA(Rows, Cols, NewInfSnake, Tail)

The TRS R consists of the following rules:

part_of_snake_in_aaaa([], RestSnake, RestSnake, []) → part_of_snake_out_aaaa([], RestSnake, RestSnake, [])
part_of_snake_in_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_out_aaaa(R, Rings, RestSnake, RestRings)) → part_of_snake_out_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings))

The argument filtering Pi contains the following mapping:
[]  =  []
.(x1, x2)  =  .(x1, x2)
part_of_snake_in_aaaa(x1, x2, x3, x4)  =  part_of_snake_in_aaaa
part_of_snake_out_aaaa(x1, x2, x3, x4)  =  part_of_snake_out_aaaa
U11_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U11_aaaa(x7)
U9_AAAA(x1, x2, x3, x4, x5, x6, x7)  =  U9_AAAA(x7)
PRODUCE_SNAKE_IN_AAAA(x1, x2, x3, x4)  =  PRODUCE_SNAKE_IN_AAAA

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ Narrowing
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

U9_AAAA(part_of_snake_out_aaaa) → PRODUCE_SNAKE_IN_AAAA
PRODUCE_SNAKE_IN_AAAAU9_AAAA(part_of_snake_in_aaaa)

The TRS R consists of the following rules:

part_of_snake_in_aaaapart_of_snake_out_aaaa
part_of_snake_in_aaaaU11_aaaa(part_of_snake_in_aaaa)
U11_aaaa(part_of_snake_out_aaaa) → part_of_snake_out_aaaa

The set Q consists of the following terms:

part_of_snake_in_aaaa
U11_aaaa(x0)

We have to consider all (P,Q,R)-chains.
By narrowing [15] the rule PRODUCE_SNAKE_IN_AAAAU9_AAAA(part_of_snake_in_aaaa) at position [0] we obtained the following new rules:

PRODUCE_SNAKE_IN_AAAAU9_AAAA(U11_aaaa(part_of_snake_in_aaaa))
PRODUCE_SNAKE_IN_AAAAU9_AAAA(part_of_snake_out_aaaa)



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ Narrowing
QDP
                            ↳ NonTerminationProof
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

PRODUCE_SNAKE_IN_AAAAU9_AAAA(U11_aaaa(part_of_snake_in_aaaa))
PRODUCE_SNAKE_IN_AAAAU9_AAAA(part_of_snake_out_aaaa)
U9_AAAA(part_of_snake_out_aaaa) → PRODUCE_SNAKE_IN_AAAA

The TRS R consists of the following rules:

part_of_snake_in_aaaapart_of_snake_out_aaaa
part_of_snake_in_aaaaU11_aaaa(part_of_snake_in_aaaa)
U11_aaaa(part_of_snake_out_aaaa) → part_of_snake_out_aaaa

The set Q consists of the following terms:

part_of_snake_in_aaaa
U11_aaaa(x0)

We have to consider all (P,Q,R)-chains.
We used the non-termination processor [17] to show that the DP problem is infinite.
Found a loop by narrowing to the left:

The TRS P consists of the following rules:

PRODUCE_SNAKE_IN_AAAAU9_AAAA(U11_aaaa(part_of_snake_in_aaaa))
PRODUCE_SNAKE_IN_AAAAU9_AAAA(part_of_snake_out_aaaa)
U9_AAAA(part_of_snake_out_aaaa) → PRODUCE_SNAKE_IN_AAAA

The TRS R consists of the following rules:

part_of_snake_in_aaaapart_of_snake_out_aaaa
part_of_snake_in_aaaaU11_aaaa(part_of_snake_in_aaaa)
U11_aaaa(part_of_snake_out_aaaa) → part_of_snake_out_aaaa


s = U9_AAAA(part_of_snake_out_aaaa) evaluates to t =U9_AAAA(part_of_snake_out_aaaa)

Thus s starts an infinite chain as s semiunifies with t with the following substitutions:




Rewriting sequence

U9_AAAA(part_of_snake_out_aaaa)PRODUCE_SNAKE_IN_AAAA
with rule U9_AAAA(part_of_snake_out_aaaa) → PRODUCE_SNAKE_IN_AAAA at position [] and matcher [ ]

PRODUCE_SNAKE_IN_AAAAU9_AAAA(part_of_snake_out_aaaa)
with rule PRODUCE_SNAKE_IN_AAAAU9_AAAA(part_of_snake_out_aaaa)

Now applying the matcher to the start term leads to a term which is equal to the last term in the rewriting sequence


All these steps are and every following step will be a correct step w.r.t to Q.





↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

INFINITE_SNAKE_IN_GAA(.(A, R), .(A, T), S) → INFINITE_SNAKE_IN_GAA(R, T, S)

The TRS R consists of the following rules:

test_snake_in_ggg(Pattern, C, R) → U1_ggg(Pattern, C, R, s2l_in_ga(C, Cols))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
s2l_in_ga(s(X), .(X1, Y)) → U4_ga(X, X1, Y, s2l_in_ga(X, Y))
U4_ga(X, X1, Y, s2l_out_ga(X, Y)) → s2l_out_ga(s(X), .(X1, Y))
U1_ggg(Pattern, C, R, s2l_out_ga(C, Cols)) → U2_ggg(Pattern, C, R, Cols, s2l_in_ga(R, Rows))
U2_ggg(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → U3_ggg(Pattern, C, R, snake_in_gaa(Pattern, Cols, Rows))
snake_in_gaa(Pattern, Cols, Rows) → U5_gaa(Pattern, Cols, Rows, infinite_snake_in_gaa(Pattern, InfSnake, InfSnake))
infinite_snake_in_gaa([], S, S) → infinite_snake_out_gaa([], S, S)
infinite_snake_in_gaa(.(A, R), .(A, T), S) → U8_gaa(A, R, T, S, infinite_snake_in_gaa(R, T, S))
U8_gaa(A, R, T, S, infinite_snake_out_gaa(R, T, S)) → infinite_snake_out_gaa(.(A, R), .(A, T), S)
U5_gaa(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → U6_gaa(Pattern, Cols, Rows, produce_snake_in_aaaa(Rows, Cols, InfSnake, Snake))
produce_snake_in_aaaa([], X, X1, []) → produce_snake_out_aaaa([], X, X1, [])
produce_snake_in_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
part_of_snake_in_aaaa([], RestSnake, RestSnake, []) → part_of_snake_out_aaaa([], RestSnake, RestSnake, [])
part_of_snake_in_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_out_aaaa(R, Rings, RestSnake, RestRings)) → part_of_snake_out_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings))
U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_in_aaaa(Rows, Cols, NewInfSnake, Tail))
U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_out_aaaa(Rows, Cols, NewInfSnake, Tail)) → produce_snake_out_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail))
U6_gaa(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → U7_gaa(Pattern, Cols, Rows, coil_it_in_ag(Snake, odd))
coil_it_in_ag([], X) → coil_it_out_ag([], X)
coil_it_in_ag(.(Line, Lines), odd) → U12_ag(Line, Lines, coil_it_in_ag(Lines, even))
coil_it_in_ag(.(Line, Lines), even) → U13_ag(Line, Lines, reverse2_in_aa(Line, Line1))
reverse2_in_aa(List, Reversed) → U15_aa(List, Reversed, reverse_in_aga(List, [], Reversed))
reverse_in_aga([], Reversed, Reversed) → reverse_out_aga([], Reversed, Reversed)
reverse_in_aga(.(Head, Tail), SoFar, Reversed) → U16_aga(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
reverse_in_aaa([], Reversed, Reversed) → reverse_out_aaa([], Reversed, Reversed)
reverse_in_aaa(.(Head, Tail), SoFar, Reversed) → U16_aaa(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
U16_aaa(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aaa(.(Head, Tail), SoFar, Reversed)
U16_aga(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aga(.(Head, Tail), SoFar, Reversed)
U15_aa(List, Reversed, reverse_out_aga(List, [], Reversed)) → reverse2_out_aa(List, Reversed)
U13_ag(Line, Lines, reverse2_out_aa(Line, Line1)) → U14_ag(Line, Lines, coil_it_in_ag(Lines, odd))
U14_ag(Line, Lines, coil_it_out_ag(Lines, odd)) → coil_it_out_ag(.(Line, Lines), even)
U12_ag(Line, Lines, coil_it_out_ag(Lines, even)) → coil_it_out_ag(.(Line, Lines), odd)
U7_gaa(Pattern, Cols, Rows, coil_it_out_ag(Snake, odd)) → snake_out_gaa(Pattern, Cols, Rows)
U3_ggg(Pattern, C, R, snake_out_gaa(Pattern, Cols, Rows)) → test_snake_out_ggg(Pattern, C, R)

The argument filtering Pi contains the following mapping:
test_snake_in_ggg(x1, x2, x3)  =  test_snake_in_ggg(x1, x2, x3)
U1_ggg(x1, x2, x3, x4)  =  U1_ggg(x1, x3, x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga
s(x1)  =  s(x1)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
U2_ggg(x1, x2, x3, x4, x5)  =  U2_ggg(x1, x5)
U3_ggg(x1, x2, x3, x4)  =  U3_ggg(x4)
snake_in_gaa(x1, x2, x3)  =  snake_in_gaa(x1)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x4)
infinite_snake_in_gaa(x1, x2, x3)  =  infinite_snake_in_gaa(x1)
[]  =  []
infinite_snake_out_gaa(x1, x2, x3)  =  infinite_snake_out_gaa
.(x1, x2)  =  .(x1, x2)
U8_gaa(x1, x2, x3, x4, x5)  =  U8_gaa(x5)
U6_gaa(x1, x2, x3, x4)  =  U6_gaa(x4)
produce_snake_in_aaaa(x1, x2, x3, x4)  =  produce_snake_in_aaaa
produce_snake_out_aaaa(x1, x2, x3, x4)  =  produce_snake_out_aaaa
U9_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U9_aaaa(x7)
part_of_snake_in_aaaa(x1, x2, x3, x4)  =  part_of_snake_in_aaaa
part_of_snake_out_aaaa(x1, x2, x3, x4)  =  part_of_snake_out_aaaa
U11_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U11_aaaa(x7)
U10_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U10_aaaa(x7)
U7_gaa(x1, x2, x3, x4)  =  U7_gaa(x4)
coil_it_in_ag(x1, x2)  =  coil_it_in_ag(x2)
coil_it_out_ag(x1, x2)  =  coil_it_out_ag
odd  =  odd
U12_ag(x1, x2, x3)  =  U12_ag(x3)
even  =  even
U13_ag(x1, x2, x3)  =  U13_ag(x3)
reverse2_in_aa(x1, x2)  =  reverse2_in_aa
U15_aa(x1, x2, x3)  =  U15_aa(x3)
reverse_in_aga(x1, x2, x3)  =  reverse_in_aga(x2)
reverse_out_aga(x1, x2, x3)  =  reverse_out_aga
U16_aga(x1, x2, x3, x4, x5)  =  U16_aga(x5)
reverse_in_aaa(x1, x2, x3)  =  reverse_in_aaa
reverse_out_aaa(x1, x2, x3)  =  reverse_out_aaa
U16_aaa(x1, x2, x3, x4, x5)  =  U16_aaa(x5)
reverse2_out_aa(x1, x2)  =  reverse2_out_aa
U14_ag(x1, x2, x3)  =  U14_ag(x3)
snake_out_gaa(x1, x2, x3)  =  snake_out_gaa
test_snake_out_ggg(x1, x2, x3)  =  test_snake_out_ggg
INFINITE_SNAKE_IN_GAA(x1, x2, x3)  =  INFINITE_SNAKE_IN_GAA(x1)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

INFINITE_SNAKE_IN_GAA(.(A, R), .(A, T), S) → INFINITE_SNAKE_IN_GAA(R, T, S)

R is empty.
The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x1, x2)
INFINITE_SNAKE_IN_GAA(x1, x2, x3)  =  INFINITE_SNAKE_IN_GAA(x1)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

INFINITE_SNAKE_IN_GAA(.(A, R)) → INFINITE_SNAKE_IN_GAA(R)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

S2L_IN_GA(s(X), .(X1, Y)) → S2L_IN_GA(X, Y)

The TRS R consists of the following rules:

test_snake_in_ggg(Pattern, C, R) → U1_ggg(Pattern, C, R, s2l_in_ga(C, Cols))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
s2l_in_ga(s(X), .(X1, Y)) → U4_ga(X, X1, Y, s2l_in_ga(X, Y))
U4_ga(X, X1, Y, s2l_out_ga(X, Y)) → s2l_out_ga(s(X), .(X1, Y))
U1_ggg(Pattern, C, R, s2l_out_ga(C, Cols)) → U2_ggg(Pattern, C, R, Cols, s2l_in_ga(R, Rows))
U2_ggg(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → U3_ggg(Pattern, C, R, snake_in_gaa(Pattern, Cols, Rows))
snake_in_gaa(Pattern, Cols, Rows) → U5_gaa(Pattern, Cols, Rows, infinite_snake_in_gaa(Pattern, InfSnake, InfSnake))
infinite_snake_in_gaa([], S, S) → infinite_snake_out_gaa([], S, S)
infinite_snake_in_gaa(.(A, R), .(A, T), S) → U8_gaa(A, R, T, S, infinite_snake_in_gaa(R, T, S))
U8_gaa(A, R, T, S, infinite_snake_out_gaa(R, T, S)) → infinite_snake_out_gaa(.(A, R), .(A, T), S)
U5_gaa(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → U6_gaa(Pattern, Cols, Rows, produce_snake_in_aaaa(Rows, Cols, InfSnake, Snake))
produce_snake_in_aaaa([], X, X1, []) → produce_snake_out_aaaa([], X, X1, [])
produce_snake_in_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
part_of_snake_in_aaaa([], RestSnake, RestSnake, []) → part_of_snake_out_aaaa([], RestSnake, RestSnake, [])
part_of_snake_in_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_out_aaaa(R, Rings, RestSnake, RestRings)) → part_of_snake_out_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings))
U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_in_aaaa(Rows, Cols, NewInfSnake, Tail))
U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_out_aaaa(Rows, Cols, NewInfSnake, Tail)) → produce_snake_out_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail))
U6_gaa(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → U7_gaa(Pattern, Cols, Rows, coil_it_in_ag(Snake, odd))
coil_it_in_ag([], X) → coil_it_out_ag([], X)
coil_it_in_ag(.(Line, Lines), odd) → U12_ag(Line, Lines, coil_it_in_ag(Lines, even))
coil_it_in_ag(.(Line, Lines), even) → U13_ag(Line, Lines, reverse2_in_aa(Line, Line1))
reverse2_in_aa(List, Reversed) → U15_aa(List, Reversed, reverse_in_aga(List, [], Reversed))
reverse_in_aga([], Reversed, Reversed) → reverse_out_aga([], Reversed, Reversed)
reverse_in_aga(.(Head, Tail), SoFar, Reversed) → U16_aga(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
reverse_in_aaa([], Reversed, Reversed) → reverse_out_aaa([], Reversed, Reversed)
reverse_in_aaa(.(Head, Tail), SoFar, Reversed) → U16_aaa(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
U16_aaa(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aaa(.(Head, Tail), SoFar, Reversed)
U16_aga(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aga(.(Head, Tail), SoFar, Reversed)
U15_aa(List, Reversed, reverse_out_aga(List, [], Reversed)) → reverse2_out_aa(List, Reversed)
U13_ag(Line, Lines, reverse2_out_aa(Line, Line1)) → U14_ag(Line, Lines, coil_it_in_ag(Lines, odd))
U14_ag(Line, Lines, coil_it_out_ag(Lines, odd)) → coil_it_out_ag(.(Line, Lines), even)
U12_ag(Line, Lines, coil_it_out_ag(Lines, even)) → coil_it_out_ag(.(Line, Lines), odd)
U7_gaa(Pattern, Cols, Rows, coil_it_out_ag(Snake, odd)) → snake_out_gaa(Pattern, Cols, Rows)
U3_ggg(Pattern, C, R, snake_out_gaa(Pattern, Cols, Rows)) → test_snake_out_ggg(Pattern, C, R)

The argument filtering Pi contains the following mapping:
test_snake_in_ggg(x1, x2, x3)  =  test_snake_in_ggg(x1, x2, x3)
U1_ggg(x1, x2, x3, x4)  =  U1_ggg(x1, x3, x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga
s(x1)  =  s(x1)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
U2_ggg(x1, x2, x3, x4, x5)  =  U2_ggg(x1, x5)
U3_ggg(x1, x2, x3, x4)  =  U3_ggg(x4)
snake_in_gaa(x1, x2, x3)  =  snake_in_gaa(x1)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x4)
infinite_snake_in_gaa(x1, x2, x3)  =  infinite_snake_in_gaa(x1)
[]  =  []
infinite_snake_out_gaa(x1, x2, x3)  =  infinite_snake_out_gaa
.(x1, x2)  =  .(x1, x2)
U8_gaa(x1, x2, x3, x4, x5)  =  U8_gaa(x5)
U6_gaa(x1, x2, x3, x4)  =  U6_gaa(x4)
produce_snake_in_aaaa(x1, x2, x3, x4)  =  produce_snake_in_aaaa
produce_snake_out_aaaa(x1, x2, x3, x4)  =  produce_snake_out_aaaa
U9_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U9_aaaa(x7)
part_of_snake_in_aaaa(x1, x2, x3, x4)  =  part_of_snake_in_aaaa
part_of_snake_out_aaaa(x1, x2, x3, x4)  =  part_of_snake_out_aaaa
U11_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U11_aaaa(x7)
U10_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U10_aaaa(x7)
U7_gaa(x1, x2, x3, x4)  =  U7_gaa(x4)
coil_it_in_ag(x1, x2)  =  coil_it_in_ag(x2)
coil_it_out_ag(x1, x2)  =  coil_it_out_ag
odd  =  odd
U12_ag(x1, x2, x3)  =  U12_ag(x3)
even  =  even
U13_ag(x1, x2, x3)  =  U13_ag(x3)
reverse2_in_aa(x1, x2)  =  reverse2_in_aa
U15_aa(x1, x2, x3)  =  U15_aa(x3)
reverse_in_aga(x1, x2, x3)  =  reverse_in_aga(x2)
reverse_out_aga(x1, x2, x3)  =  reverse_out_aga
U16_aga(x1, x2, x3, x4, x5)  =  U16_aga(x5)
reverse_in_aaa(x1, x2, x3)  =  reverse_in_aaa
reverse_out_aaa(x1, x2, x3)  =  reverse_out_aaa
U16_aaa(x1, x2, x3, x4, x5)  =  U16_aaa(x5)
reverse2_out_aa(x1, x2)  =  reverse2_out_aa
U14_ag(x1, x2, x3)  =  U14_ag(x3)
snake_out_gaa(x1, x2, x3)  =  snake_out_gaa
test_snake_out_ggg(x1, x2, x3)  =  test_snake_out_ggg
S2L_IN_GA(x1, x2)  =  S2L_IN_GA(x1)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

S2L_IN_GA(s(X), .(X1, Y)) → S2L_IN_GA(X, Y)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
.(x1, x2)  =  .(x1, x2)
S2L_IN_GA(x1, x2)  =  S2L_IN_GA(x1)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

S2L_IN_GA(s(X)) → S2L_IN_GA(X)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:


We use the technique of [30]. With regard to the inferred argument filtering the predicates were used in the following modes:
test_snake_in: (b,b,b)
s2l_in: (b,f)
snake_in: (b,f,f)
infinite_snake_in: (b,f,f)
produce_snake_in: (f,f,f,f)
part_of_snake_in: (f,f,f,f)
coil_it_in: (f,b)
reverse2_in: (f,f)
reverse_in: (f,b,f) (f,f,f)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

test_snake_in_ggg(Pattern, C, R) → U1_ggg(Pattern, C, R, s2l_in_ga(C, Cols))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
s2l_in_ga(s(X), .(X1, Y)) → U4_ga(X, X1, Y, s2l_in_ga(X, Y))
U4_ga(X, X1, Y, s2l_out_ga(X, Y)) → s2l_out_ga(s(X), .(X1, Y))
U1_ggg(Pattern, C, R, s2l_out_ga(C, Cols)) → U2_ggg(Pattern, C, R, Cols, s2l_in_ga(R, Rows))
U2_ggg(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → U3_ggg(Pattern, C, R, snake_in_gaa(Pattern, Cols, Rows))
snake_in_gaa(Pattern, Cols, Rows) → U5_gaa(Pattern, Cols, Rows, infinite_snake_in_gaa(Pattern, InfSnake, InfSnake))
infinite_snake_in_gaa([], S, S) → infinite_snake_out_gaa([], S, S)
infinite_snake_in_gaa(.(A, R), .(A, T), S) → U8_gaa(A, R, T, S, infinite_snake_in_gaa(R, T, S))
U8_gaa(A, R, T, S, infinite_snake_out_gaa(R, T, S)) → infinite_snake_out_gaa(.(A, R), .(A, T), S)
U5_gaa(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → U6_gaa(Pattern, Cols, Rows, produce_snake_in_aaaa(Rows, Cols, InfSnake, Snake))
produce_snake_in_aaaa([], X, X1, []) → produce_snake_out_aaaa([], X, X1, [])
produce_snake_in_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
part_of_snake_in_aaaa([], RestSnake, RestSnake, []) → part_of_snake_out_aaaa([], RestSnake, RestSnake, [])
part_of_snake_in_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_out_aaaa(R, Rings, RestSnake, RestRings)) → part_of_snake_out_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings))
U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_in_aaaa(Rows, Cols, NewInfSnake, Tail))
U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_out_aaaa(Rows, Cols, NewInfSnake, Tail)) → produce_snake_out_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail))
U6_gaa(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → U7_gaa(Pattern, Cols, Rows, coil_it_in_ag(Snake, odd))
coil_it_in_ag([], X) → coil_it_out_ag([], X)
coil_it_in_ag(.(Line, Lines), odd) → U12_ag(Line, Lines, coil_it_in_ag(Lines, even))
coil_it_in_ag(.(Line, Lines), even) → U13_ag(Line, Lines, reverse2_in_aa(Line, Line1))
reverse2_in_aa(List, Reversed) → U15_aa(List, Reversed, reverse_in_aga(List, [], Reversed))
reverse_in_aga([], Reversed, Reversed) → reverse_out_aga([], Reversed, Reversed)
reverse_in_aga(.(Head, Tail), SoFar, Reversed) → U16_aga(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
reverse_in_aaa([], Reversed, Reversed) → reverse_out_aaa([], Reversed, Reversed)
reverse_in_aaa(.(Head, Tail), SoFar, Reversed) → U16_aaa(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
U16_aaa(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aaa(.(Head, Tail), SoFar, Reversed)
U16_aga(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aga(.(Head, Tail), SoFar, Reversed)
U15_aa(List, Reversed, reverse_out_aga(List, [], Reversed)) → reverse2_out_aa(List, Reversed)
U13_ag(Line, Lines, reverse2_out_aa(Line, Line1)) → U14_ag(Line, Lines, coil_it_in_ag(Lines, odd))
U14_ag(Line, Lines, coil_it_out_ag(Lines, odd)) → coil_it_out_ag(.(Line, Lines), even)
U12_ag(Line, Lines, coil_it_out_ag(Lines, even)) → coil_it_out_ag(.(Line, Lines), odd)
U7_gaa(Pattern, Cols, Rows, coil_it_out_ag(Snake, odd)) → snake_out_gaa(Pattern, Cols, Rows)
U3_ggg(Pattern, C, R, snake_out_gaa(Pattern, Cols, Rows)) → test_snake_out_ggg(Pattern, C, R)

The argument filtering Pi contains the following mapping:
test_snake_in_ggg(x1, x2, x3)  =  test_snake_in_ggg(x1, x2, x3)
U1_ggg(x1, x2, x3, x4)  =  U1_ggg(x1, x2, x3, x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga(x1)
s(x1)  =  s(x1)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x1, x4)
U2_ggg(x1, x2, x3, x4, x5)  =  U2_ggg(x1, x2, x3, x5)
U3_ggg(x1, x2, x3, x4)  =  U3_ggg(x1, x2, x3, x4)
snake_in_gaa(x1, x2, x3)  =  snake_in_gaa(x1)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x1, x4)
infinite_snake_in_gaa(x1, x2, x3)  =  infinite_snake_in_gaa(x1)
[]  =  []
infinite_snake_out_gaa(x1, x2, x3)  =  infinite_snake_out_gaa(x1)
.(x1, x2)  =  .(x1, x2)
U8_gaa(x1, x2, x3, x4, x5)  =  U8_gaa(x1, x2, x5)
U6_gaa(x1, x2, x3, x4)  =  U6_gaa(x1, x4)
produce_snake_in_aaaa(x1, x2, x3, x4)  =  produce_snake_in_aaaa
produce_snake_out_aaaa(x1, x2, x3, x4)  =  produce_snake_out_aaaa
U9_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U9_aaaa(x7)
part_of_snake_in_aaaa(x1, x2, x3, x4)  =  part_of_snake_in_aaaa
part_of_snake_out_aaaa(x1, x2, x3, x4)  =  part_of_snake_out_aaaa
U11_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U11_aaaa(x7)
U10_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U10_aaaa(x7)
U7_gaa(x1, x2, x3, x4)  =  U7_gaa(x1, x4)
coil_it_in_ag(x1, x2)  =  coil_it_in_ag(x2)
coil_it_out_ag(x1, x2)  =  coil_it_out_ag(x2)
odd  =  odd
U12_ag(x1, x2, x3)  =  U12_ag(x3)
even  =  even
U13_ag(x1, x2, x3)  =  U13_ag(x3)
reverse2_in_aa(x1, x2)  =  reverse2_in_aa
U15_aa(x1, x2, x3)  =  U15_aa(x3)
reverse_in_aga(x1, x2, x3)  =  reverse_in_aga(x2)
reverse_out_aga(x1, x2, x3)  =  reverse_out_aga(x2)
U16_aga(x1, x2, x3, x4, x5)  =  U16_aga(x3, x5)
reverse_in_aaa(x1, x2, x3)  =  reverse_in_aaa
reverse_out_aaa(x1, x2, x3)  =  reverse_out_aaa
U16_aaa(x1, x2, x3, x4, x5)  =  U16_aaa(x5)
reverse2_out_aa(x1, x2)  =  reverse2_out_aa
U14_ag(x1, x2, x3)  =  U14_ag(x3)
snake_out_gaa(x1, x2, x3)  =  snake_out_gaa(x1)
test_snake_out_ggg(x1, x2, x3)  =  test_snake_out_ggg(x1, x2, x3)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog



↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

test_snake_in_ggg(Pattern, C, R) → U1_ggg(Pattern, C, R, s2l_in_ga(C, Cols))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
s2l_in_ga(s(X), .(X1, Y)) → U4_ga(X, X1, Y, s2l_in_ga(X, Y))
U4_ga(X, X1, Y, s2l_out_ga(X, Y)) → s2l_out_ga(s(X), .(X1, Y))
U1_ggg(Pattern, C, R, s2l_out_ga(C, Cols)) → U2_ggg(Pattern, C, R, Cols, s2l_in_ga(R, Rows))
U2_ggg(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → U3_ggg(Pattern, C, R, snake_in_gaa(Pattern, Cols, Rows))
snake_in_gaa(Pattern, Cols, Rows) → U5_gaa(Pattern, Cols, Rows, infinite_snake_in_gaa(Pattern, InfSnake, InfSnake))
infinite_snake_in_gaa([], S, S) → infinite_snake_out_gaa([], S, S)
infinite_snake_in_gaa(.(A, R), .(A, T), S) → U8_gaa(A, R, T, S, infinite_snake_in_gaa(R, T, S))
U8_gaa(A, R, T, S, infinite_snake_out_gaa(R, T, S)) → infinite_snake_out_gaa(.(A, R), .(A, T), S)
U5_gaa(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → U6_gaa(Pattern, Cols, Rows, produce_snake_in_aaaa(Rows, Cols, InfSnake, Snake))
produce_snake_in_aaaa([], X, X1, []) → produce_snake_out_aaaa([], X, X1, [])
produce_snake_in_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
part_of_snake_in_aaaa([], RestSnake, RestSnake, []) → part_of_snake_out_aaaa([], RestSnake, RestSnake, [])
part_of_snake_in_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_out_aaaa(R, Rings, RestSnake, RestRings)) → part_of_snake_out_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings))
U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_in_aaaa(Rows, Cols, NewInfSnake, Tail))
U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_out_aaaa(Rows, Cols, NewInfSnake, Tail)) → produce_snake_out_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail))
U6_gaa(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → U7_gaa(Pattern, Cols, Rows, coil_it_in_ag(Snake, odd))
coil_it_in_ag([], X) → coil_it_out_ag([], X)
coil_it_in_ag(.(Line, Lines), odd) → U12_ag(Line, Lines, coil_it_in_ag(Lines, even))
coil_it_in_ag(.(Line, Lines), even) → U13_ag(Line, Lines, reverse2_in_aa(Line, Line1))
reverse2_in_aa(List, Reversed) → U15_aa(List, Reversed, reverse_in_aga(List, [], Reversed))
reverse_in_aga([], Reversed, Reversed) → reverse_out_aga([], Reversed, Reversed)
reverse_in_aga(.(Head, Tail), SoFar, Reversed) → U16_aga(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
reverse_in_aaa([], Reversed, Reversed) → reverse_out_aaa([], Reversed, Reversed)
reverse_in_aaa(.(Head, Tail), SoFar, Reversed) → U16_aaa(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
U16_aaa(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aaa(.(Head, Tail), SoFar, Reversed)
U16_aga(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aga(.(Head, Tail), SoFar, Reversed)
U15_aa(List, Reversed, reverse_out_aga(List, [], Reversed)) → reverse2_out_aa(List, Reversed)
U13_ag(Line, Lines, reverse2_out_aa(Line, Line1)) → U14_ag(Line, Lines, coil_it_in_ag(Lines, odd))
U14_ag(Line, Lines, coil_it_out_ag(Lines, odd)) → coil_it_out_ag(.(Line, Lines), even)
U12_ag(Line, Lines, coil_it_out_ag(Lines, even)) → coil_it_out_ag(.(Line, Lines), odd)
U7_gaa(Pattern, Cols, Rows, coil_it_out_ag(Snake, odd)) → snake_out_gaa(Pattern, Cols, Rows)
U3_ggg(Pattern, C, R, snake_out_gaa(Pattern, Cols, Rows)) → test_snake_out_ggg(Pattern, C, R)

The argument filtering Pi contains the following mapping:
test_snake_in_ggg(x1, x2, x3)  =  test_snake_in_ggg(x1, x2, x3)
U1_ggg(x1, x2, x3, x4)  =  U1_ggg(x1, x2, x3, x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga(x1)
s(x1)  =  s(x1)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x1, x4)
U2_ggg(x1, x2, x3, x4, x5)  =  U2_ggg(x1, x2, x3, x5)
U3_ggg(x1, x2, x3, x4)  =  U3_ggg(x1, x2, x3, x4)
snake_in_gaa(x1, x2, x3)  =  snake_in_gaa(x1)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x1, x4)
infinite_snake_in_gaa(x1, x2, x3)  =  infinite_snake_in_gaa(x1)
[]  =  []
infinite_snake_out_gaa(x1, x2, x3)  =  infinite_snake_out_gaa(x1)
.(x1, x2)  =  .(x1, x2)
U8_gaa(x1, x2, x3, x4, x5)  =  U8_gaa(x1, x2, x5)
U6_gaa(x1, x2, x3, x4)  =  U6_gaa(x1, x4)
produce_snake_in_aaaa(x1, x2, x3, x4)  =  produce_snake_in_aaaa
produce_snake_out_aaaa(x1, x2, x3, x4)  =  produce_snake_out_aaaa
U9_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U9_aaaa(x7)
part_of_snake_in_aaaa(x1, x2, x3, x4)  =  part_of_snake_in_aaaa
part_of_snake_out_aaaa(x1, x2, x3, x4)  =  part_of_snake_out_aaaa
U11_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U11_aaaa(x7)
U10_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U10_aaaa(x7)
U7_gaa(x1, x2, x3, x4)  =  U7_gaa(x1, x4)
coil_it_in_ag(x1, x2)  =  coil_it_in_ag(x2)
coil_it_out_ag(x1, x2)  =  coil_it_out_ag(x2)
odd  =  odd
U12_ag(x1, x2, x3)  =  U12_ag(x3)
even  =  even
U13_ag(x1, x2, x3)  =  U13_ag(x3)
reverse2_in_aa(x1, x2)  =  reverse2_in_aa
U15_aa(x1, x2, x3)  =  U15_aa(x3)
reverse_in_aga(x1, x2, x3)  =  reverse_in_aga(x2)
reverse_out_aga(x1, x2, x3)  =  reverse_out_aga(x2)
U16_aga(x1, x2, x3, x4, x5)  =  U16_aga(x3, x5)
reverse_in_aaa(x1, x2, x3)  =  reverse_in_aaa
reverse_out_aaa(x1, x2, x3)  =  reverse_out_aaa
U16_aaa(x1, x2, x3, x4, x5)  =  U16_aaa(x5)
reverse2_out_aa(x1, x2)  =  reverse2_out_aa
U14_ag(x1, x2, x3)  =  U14_ag(x3)
snake_out_gaa(x1, x2, x3)  =  snake_out_gaa(x1)
test_snake_out_ggg(x1, x2, x3)  =  test_snake_out_ggg(x1, x2, x3)


Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

TEST_SNAKE_IN_GGG(Pattern, C, R) → U1_GGG(Pattern, C, R, s2l_in_ga(C, Cols))
TEST_SNAKE_IN_GGG(Pattern, C, R) → S2L_IN_GA(C, Cols)
S2L_IN_GA(s(X), .(X1, Y)) → U4_GA(X, X1, Y, s2l_in_ga(X, Y))
S2L_IN_GA(s(X), .(X1, Y)) → S2L_IN_GA(X, Y)
U1_GGG(Pattern, C, R, s2l_out_ga(C, Cols)) → U2_GGG(Pattern, C, R, Cols, s2l_in_ga(R, Rows))
U1_GGG(Pattern, C, R, s2l_out_ga(C, Cols)) → S2L_IN_GA(R, Rows)
U2_GGG(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → U3_GGG(Pattern, C, R, snake_in_gaa(Pattern, Cols, Rows))
U2_GGG(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → SNAKE_IN_GAA(Pattern, Cols, Rows)
SNAKE_IN_GAA(Pattern, Cols, Rows) → U5_GAA(Pattern, Cols, Rows, infinite_snake_in_gaa(Pattern, InfSnake, InfSnake))
SNAKE_IN_GAA(Pattern, Cols, Rows) → INFINITE_SNAKE_IN_GAA(Pattern, InfSnake, InfSnake)
INFINITE_SNAKE_IN_GAA(.(A, R), .(A, T), S) → U8_GAA(A, R, T, S, infinite_snake_in_gaa(R, T, S))
INFINITE_SNAKE_IN_GAA(.(A, R), .(A, T), S) → INFINITE_SNAKE_IN_GAA(R, T, S)
U5_GAA(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → U6_GAA(Pattern, Cols, Rows, produce_snake_in_aaaa(Rows, Cols, InfSnake, Snake))
U5_GAA(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → PRODUCE_SNAKE_IN_AAAA(Rows, Cols, InfSnake, Snake)
PRODUCE_SNAKE_IN_AAAA(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_AAAA(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
PRODUCE_SNAKE_IN_AAAA(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → PART_OF_SNAKE_IN_AAAA(Cols, InfSnake, NewInfSnake, Part)
PART_OF_SNAKE_IN_AAAA(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_AAAA(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
PART_OF_SNAKE_IN_AAAA(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → PART_OF_SNAKE_IN_AAAA(R, Rings, RestSnake, RestRings)
U9_AAAA(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → U10_AAAA(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_in_aaaa(Rows, Cols, NewInfSnake, Tail))
U9_AAAA(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → PRODUCE_SNAKE_IN_AAAA(Rows, Cols, NewInfSnake, Tail)
U6_GAA(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → U7_GAA(Pattern, Cols, Rows, coil_it_in_ag(Snake, odd))
U6_GAA(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → COIL_IT_IN_AG(Snake, odd)
COIL_IT_IN_AG(.(Line, Lines), odd) → U12_AG(Line, Lines, coil_it_in_ag(Lines, even))
COIL_IT_IN_AG(.(Line, Lines), odd) → COIL_IT_IN_AG(Lines, even)
COIL_IT_IN_AG(.(Line, Lines), even) → U13_AG(Line, Lines, reverse2_in_aa(Line, Line1))
COIL_IT_IN_AG(.(Line, Lines), even) → REVERSE2_IN_AA(Line, Line1)
REVERSE2_IN_AA(List, Reversed) → U15_AA(List, Reversed, reverse_in_aga(List, [], Reversed))
REVERSE2_IN_AA(List, Reversed) → REVERSE_IN_AGA(List, [], Reversed)
REVERSE_IN_AGA(.(Head, Tail), SoFar, Reversed) → U16_AGA(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
REVERSE_IN_AGA(.(Head, Tail), SoFar, Reversed) → REVERSE_IN_AAA(Tail, .(Head, SoFar), Reversed)
REVERSE_IN_AAA(.(Head, Tail), SoFar, Reversed) → U16_AAA(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
REVERSE_IN_AAA(.(Head, Tail), SoFar, Reversed) → REVERSE_IN_AAA(Tail, .(Head, SoFar), Reversed)
U13_AG(Line, Lines, reverse2_out_aa(Line, Line1)) → U14_AG(Line, Lines, coil_it_in_ag(Lines, odd))
U13_AG(Line, Lines, reverse2_out_aa(Line, Line1)) → COIL_IT_IN_AG(Lines, odd)

The TRS R consists of the following rules:

test_snake_in_ggg(Pattern, C, R) → U1_ggg(Pattern, C, R, s2l_in_ga(C, Cols))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
s2l_in_ga(s(X), .(X1, Y)) → U4_ga(X, X1, Y, s2l_in_ga(X, Y))
U4_ga(X, X1, Y, s2l_out_ga(X, Y)) → s2l_out_ga(s(X), .(X1, Y))
U1_ggg(Pattern, C, R, s2l_out_ga(C, Cols)) → U2_ggg(Pattern, C, R, Cols, s2l_in_ga(R, Rows))
U2_ggg(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → U3_ggg(Pattern, C, R, snake_in_gaa(Pattern, Cols, Rows))
snake_in_gaa(Pattern, Cols, Rows) → U5_gaa(Pattern, Cols, Rows, infinite_snake_in_gaa(Pattern, InfSnake, InfSnake))
infinite_snake_in_gaa([], S, S) → infinite_snake_out_gaa([], S, S)
infinite_snake_in_gaa(.(A, R), .(A, T), S) → U8_gaa(A, R, T, S, infinite_snake_in_gaa(R, T, S))
U8_gaa(A, R, T, S, infinite_snake_out_gaa(R, T, S)) → infinite_snake_out_gaa(.(A, R), .(A, T), S)
U5_gaa(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → U6_gaa(Pattern, Cols, Rows, produce_snake_in_aaaa(Rows, Cols, InfSnake, Snake))
produce_snake_in_aaaa([], X, X1, []) → produce_snake_out_aaaa([], X, X1, [])
produce_snake_in_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
part_of_snake_in_aaaa([], RestSnake, RestSnake, []) → part_of_snake_out_aaaa([], RestSnake, RestSnake, [])
part_of_snake_in_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_out_aaaa(R, Rings, RestSnake, RestRings)) → part_of_snake_out_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings))
U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_in_aaaa(Rows, Cols, NewInfSnake, Tail))
U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_out_aaaa(Rows, Cols, NewInfSnake, Tail)) → produce_snake_out_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail))
U6_gaa(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → U7_gaa(Pattern, Cols, Rows, coil_it_in_ag(Snake, odd))
coil_it_in_ag([], X) → coil_it_out_ag([], X)
coil_it_in_ag(.(Line, Lines), odd) → U12_ag(Line, Lines, coil_it_in_ag(Lines, even))
coil_it_in_ag(.(Line, Lines), even) → U13_ag(Line, Lines, reverse2_in_aa(Line, Line1))
reverse2_in_aa(List, Reversed) → U15_aa(List, Reversed, reverse_in_aga(List, [], Reversed))
reverse_in_aga([], Reversed, Reversed) → reverse_out_aga([], Reversed, Reversed)
reverse_in_aga(.(Head, Tail), SoFar, Reversed) → U16_aga(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
reverse_in_aaa([], Reversed, Reversed) → reverse_out_aaa([], Reversed, Reversed)
reverse_in_aaa(.(Head, Tail), SoFar, Reversed) → U16_aaa(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
U16_aaa(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aaa(.(Head, Tail), SoFar, Reversed)
U16_aga(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aga(.(Head, Tail), SoFar, Reversed)
U15_aa(List, Reversed, reverse_out_aga(List, [], Reversed)) → reverse2_out_aa(List, Reversed)
U13_ag(Line, Lines, reverse2_out_aa(Line, Line1)) → U14_ag(Line, Lines, coil_it_in_ag(Lines, odd))
U14_ag(Line, Lines, coil_it_out_ag(Lines, odd)) → coil_it_out_ag(.(Line, Lines), even)
U12_ag(Line, Lines, coil_it_out_ag(Lines, even)) → coil_it_out_ag(.(Line, Lines), odd)
U7_gaa(Pattern, Cols, Rows, coil_it_out_ag(Snake, odd)) → snake_out_gaa(Pattern, Cols, Rows)
U3_ggg(Pattern, C, R, snake_out_gaa(Pattern, Cols, Rows)) → test_snake_out_ggg(Pattern, C, R)

The argument filtering Pi contains the following mapping:
test_snake_in_ggg(x1, x2, x3)  =  test_snake_in_ggg(x1, x2, x3)
U1_ggg(x1, x2, x3, x4)  =  U1_ggg(x1, x2, x3, x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga(x1)
s(x1)  =  s(x1)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x1, x4)
U2_ggg(x1, x2, x3, x4, x5)  =  U2_ggg(x1, x2, x3, x5)
U3_ggg(x1, x2, x3, x4)  =  U3_ggg(x1, x2, x3, x4)
snake_in_gaa(x1, x2, x3)  =  snake_in_gaa(x1)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x1, x4)
infinite_snake_in_gaa(x1, x2, x3)  =  infinite_snake_in_gaa(x1)
[]  =  []
infinite_snake_out_gaa(x1, x2, x3)  =  infinite_snake_out_gaa(x1)
.(x1, x2)  =  .(x1, x2)
U8_gaa(x1, x2, x3, x4, x5)  =  U8_gaa(x1, x2, x5)
U6_gaa(x1, x2, x3, x4)  =  U6_gaa(x1, x4)
produce_snake_in_aaaa(x1, x2, x3, x4)  =  produce_snake_in_aaaa
produce_snake_out_aaaa(x1, x2, x3, x4)  =  produce_snake_out_aaaa
U9_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U9_aaaa(x7)
part_of_snake_in_aaaa(x1, x2, x3, x4)  =  part_of_snake_in_aaaa
part_of_snake_out_aaaa(x1, x2, x3, x4)  =  part_of_snake_out_aaaa
U11_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U11_aaaa(x7)
U10_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U10_aaaa(x7)
U7_gaa(x1, x2, x3, x4)  =  U7_gaa(x1, x4)
coil_it_in_ag(x1, x2)  =  coil_it_in_ag(x2)
coil_it_out_ag(x1, x2)  =  coil_it_out_ag(x2)
odd  =  odd
U12_ag(x1, x2, x3)  =  U12_ag(x3)
even  =  even
U13_ag(x1, x2, x3)  =  U13_ag(x3)
reverse2_in_aa(x1, x2)  =  reverse2_in_aa
U15_aa(x1, x2, x3)  =  U15_aa(x3)
reverse_in_aga(x1, x2, x3)  =  reverse_in_aga(x2)
reverse_out_aga(x1, x2, x3)  =  reverse_out_aga(x2)
U16_aga(x1, x2, x3, x4, x5)  =  U16_aga(x3, x5)
reverse_in_aaa(x1, x2, x3)  =  reverse_in_aaa
reverse_out_aaa(x1, x2, x3)  =  reverse_out_aaa
U16_aaa(x1, x2, x3, x4, x5)  =  U16_aaa(x5)
reverse2_out_aa(x1, x2)  =  reverse2_out_aa
U14_ag(x1, x2, x3)  =  U14_ag(x3)
snake_out_gaa(x1, x2, x3)  =  snake_out_gaa(x1)
test_snake_out_ggg(x1, x2, x3)  =  test_snake_out_ggg(x1, x2, x3)
U14_AG(x1, x2, x3)  =  U14_AG(x3)
S2L_IN_GA(x1, x2)  =  S2L_IN_GA(x1)
TEST_SNAKE_IN_GGG(x1, x2, x3)  =  TEST_SNAKE_IN_GGG(x1, x2, x3)
INFINITE_SNAKE_IN_GAA(x1, x2, x3)  =  INFINITE_SNAKE_IN_GAA(x1)
REVERSE_IN_AGA(x1, x2, x3)  =  REVERSE_IN_AGA(x2)
U1_GGG(x1, x2, x3, x4)  =  U1_GGG(x1, x2, x3, x4)
U4_GA(x1, x2, x3, x4)  =  U4_GA(x1, x4)
U3_GGG(x1, x2, x3, x4)  =  U3_GGG(x1, x2, x3, x4)
REVERSE2_IN_AA(x1, x2)  =  REVERSE2_IN_AA
U16_AGA(x1, x2, x3, x4, x5)  =  U16_AGA(x3, x5)
REVERSE_IN_AAA(x1, x2, x3)  =  REVERSE_IN_AAA
SNAKE_IN_GAA(x1, x2, x3)  =  SNAKE_IN_GAA(x1)
COIL_IT_IN_AG(x1, x2)  =  COIL_IT_IN_AG(x2)
PART_OF_SNAKE_IN_AAAA(x1, x2, x3, x4)  =  PART_OF_SNAKE_IN_AAAA
U9_AAAA(x1, x2, x3, x4, x5, x6, x7)  =  U9_AAAA(x7)
U16_AAA(x1, x2, x3, x4, x5)  =  U16_AAA(x5)
U10_AAAA(x1, x2, x3, x4, x5, x6, x7)  =  U10_AAAA(x7)
U5_GAA(x1, x2, x3, x4)  =  U5_GAA(x1, x4)
U11_AAAA(x1, x2, x3, x4, x5, x6, x7)  =  U11_AAAA(x7)
U8_GAA(x1, x2, x3, x4, x5)  =  U8_GAA(x1, x2, x5)
U13_AG(x1, x2, x3)  =  U13_AG(x3)
U6_GAA(x1, x2, x3, x4)  =  U6_GAA(x1, x4)
PRODUCE_SNAKE_IN_AAAA(x1, x2, x3, x4)  =  PRODUCE_SNAKE_IN_AAAA
U2_GGG(x1, x2, x3, x4, x5)  =  U2_GGG(x1, x2, x3, x5)
U15_AA(x1, x2, x3)  =  U15_AA(x3)
U12_AG(x1, x2, x3)  =  U12_AG(x3)
U7_GAA(x1, x2, x3, x4)  =  U7_GAA(x1, x4)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof

Pi DP problem:
The TRS P consists of the following rules:

TEST_SNAKE_IN_GGG(Pattern, C, R) → U1_GGG(Pattern, C, R, s2l_in_ga(C, Cols))
TEST_SNAKE_IN_GGG(Pattern, C, R) → S2L_IN_GA(C, Cols)
S2L_IN_GA(s(X), .(X1, Y)) → U4_GA(X, X1, Y, s2l_in_ga(X, Y))
S2L_IN_GA(s(X), .(X1, Y)) → S2L_IN_GA(X, Y)
U1_GGG(Pattern, C, R, s2l_out_ga(C, Cols)) → U2_GGG(Pattern, C, R, Cols, s2l_in_ga(R, Rows))
U1_GGG(Pattern, C, R, s2l_out_ga(C, Cols)) → S2L_IN_GA(R, Rows)
U2_GGG(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → U3_GGG(Pattern, C, R, snake_in_gaa(Pattern, Cols, Rows))
U2_GGG(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → SNAKE_IN_GAA(Pattern, Cols, Rows)
SNAKE_IN_GAA(Pattern, Cols, Rows) → U5_GAA(Pattern, Cols, Rows, infinite_snake_in_gaa(Pattern, InfSnake, InfSnake))
SNAKE_IN_GAA(Pattern, Cols, Rows) → INFINITE_SNAKE_IN_GAA(Pattern, InfSnake, InfSnake)
INFINITE_SNAKE_IN_GAA(.(A, R), .(A, T), S) → U8_GAA(A, R, T, S, infinite_snake_in_gaa(R, T, S))
INFINITE_SNAKE_IN_GAA(.(A, R), .(A, T), S) → INFINITE_SNAKE_IN_GAA(R, T, S)
U5_GAA(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → U6_GAA(Pattern, Cols, Rows, produce_snake_in_aaaa(Rows, Cols, InfSnake, Snake))
U5_GAA(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → PRODUCE_SNAKE_IN_AAAA(Rows, Cols, InfSnake, Snake)
PRODUCE_SNAKE_IN_AAAA(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_AAAA(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
PRODUCE_SNAKE_IN_AAAA(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → PART_OF_SNAKE_IN_AAAA(Cols, InfSnake, NewInfSnake, Part)
PART_OF_SNAKE_IN_AAAA(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_AAAA(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
PART_OF_SNAKE_IN_AAAA(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → PART_OF_SNAKE_IN_AAAA(R, Rings, RestSnake, RestRings)
U9_AAAA(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → U10_AAAA(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_in_aaaa(Rows, Cols, NewInfSnake, Tail))
U9_AAAA(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → PRODUCE_SNAKE_IN_AAAA(Rows, Cols, NewInfSnake, Tail)
U6_GAA(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → U7_GAA(Pattern, Cols, Rows, coil_it_in_ag(Snake, odd))
U6_GAA(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → COIL_IT_IN_AG(Snake, odd)
COIL_IT_IN_AG(.(Line, Lines), odd) → U12_AG(Line, Lines, coil_it_in_ag(Lines, even))
COIL_IT_IN_AG(.(Line, Lines), odd) → COIL_IT_IN_AG(Lines, even)
COIL_IT_IN_AG(.(Line, Lines), even) → U13_AG(Line, Lines, reverse2_in_aa(Line, Line1))
COIL_IT_IN_AG(.(Line, Lines), even) → REVERSE2_IN_AA(Line, Line1)
REVERSE2_IN_AA(List, Reversed) → U15_AA(List, Reversed, reverse_in_aga(List, [], Reversed))
REVERSE2_IN_AA(List, Reversed) → REVERSE_IN_AGA(List, [], Reversed)
REVERSE_IN_AGA(.(Head, Tail), SoFar, Reversed) → U16_AGA(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
REVERSE_IN_AGA(.(Head, Tail), SoFar, Reversed) → REVERSE_IN_AAA(Tail, .(Head, SoFar), Reversed)
REVERSE_IN_AAA(.(Head, Tail), SoFar, Reversed) → U16_AAA(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
REVERSE_IN_AAA(.(Head, Tail), SoFar, Reversed) → REVERSE_IN_AAA(Tail, .(Head, SoFar), Reversed)
U13_AG(Line, Lines, reverse2_out_aa(Line, Line1)) → U14_AG(Line, Lines, coil_it_in_ag(Lines, odd))
U13_AG(Line, Lines, reverse2_out_aa(Line, Line1)) → COIL_IT_IN_AG(Lines, odd)

The TRS R consists of the following rules:

test_snake_in_ggg(Pattern, C, R) → U1_ggg(Pattern, C, R, s2l_in_ga(C, Cols))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
s2l_in_ga(s(X), .(X1, Y)) → U4_ga(X, X1, Y, s2l_in_ga(X, Y))
U4_ga(X, X1, Y, s2l_out_ga(X, Y)) → s2l_out_ga(s(X), .(X1, Y))
U1_ggg(Pattern, C, R, s2l_out_ga(C, Cols)) → U2_ggg(Pattern, C, R, Cols, s2l_in_ga(R, Rows))
U2_ggg(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → U3_ggg(Pattern, C, R, snake_in_gaa(Pattern, Cols, Rows))
snake_in_gaa(Pattern, Cols, Rows) → U5_gaa(Pattern, Cols, Rows, infinite_snake_in_gaa(Pattern, InfSnake, InfSnake))
infinite_snake_in_gaa([], S, S) → infinite_snake_out_gaa([], S, S)
infinite_snake_in_gaa(.(A, R), .(A, T), S) → U8_gaa(A, R, T, S, infinite_snake_in_gaa(R, T, S))
U8_gaa(A, R, T, S, infinite_snake_out_gaa(R, T, S)) → infinite_snake_out_gaa(.(A, R), .(A, T), S)
U5_gaa(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → U6_gaa(Pattern, Cols, Rows, produce_snake_in_aaaa(Rows, Cols, InfSnake, Snake))
produce_snake_in_aaaa([], X, X1, []) → produce_snake_out_aaaa([], X, X1, [])
produce_snake_in_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
part_of_snake_in_aaaa([], RestSnake, RestSnake, []) → part_of_snake_out_aaaa([], RestSnake, RestSnake, [])
part_of_snake_in_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_out_aaaa(R, Rings, RestSnake, RestRings)) → part_of_snake_out_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings))
U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_in_aaaa(Rows, Cols, NewInfSnake, Tail))
U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_out_aaaa(Rows, Cols, NewInfSnake, Tail)) → produce_snake_out_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail))
U6_gaa(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → U7_gaa(Pattern, Cols, Rows, coil_it_in_ag(Snake, odd))
coil_it_in_ag([], X) → coil_it_out_ag([], X)
coil_it_in_ag(.(Line, Lines), odd) → U12_ag(Line, Lines, coil_it_in_ag(Lines, even))
coil_it_in_ag(.(Line, Lines), even) → U13_ag(Line, Lines, reverse2_in_aa(Line, Line1))
reverse2_in_aa(List, Reversed) → U15_aa(List, Reversed, reverse_in_aga(List, [], Reversed))
reverse_in_aga([], Reversed, Reversed) → reverse_out_aga([], Reversed, Reversed)
reverse_in_aga(.(Head, Tail), SoFar, Reversed) → U16_aga(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
reverse_in_aaa([], Reversed, Reversed) → reverse_out_aaa([], Reversed, Reversed)
reverse_in_aaa(.(Head, Tail), SoFar, Reversed) → U16_aaa(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
U16_aaa(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aaa(.(Head, Tail), SoFar, Reversed)
U16_aga(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aga(.(Head, Tail), SoFar, Reversed)
U15_aa(List, Reversed, reverse_out_aga(List, [], Reversed)) → reverse2_out_aa(List, Reversed)
U13_ag(Line, Lines, reverse2_out_aa(Line, Line1)) → U14_ag(Line, Lines, coil_it_in_ag(Lines, odd))
U14_ag(Line, Lines, coil_it_out_ag(Lines, odd)) → coil_it_out_ag(.(Line, Lines), even)
U12_ag(Line, Lines, coil_it_out_ag(Lines, even)) → coil_it_out_ag(.(Line, Lines), odd)
U7_gaa(Pattern, Cols, Rows, coil_it_out_ag(Snake, odd)) → snake_out_gaa(Pattern, Cols, Rows)
U3_ggg(Pattern, C, R, snake_out_gaa(Pattern, Cols, Rows)) → test_snake_out_ggg(Pattern, C, R)

The argument filtering Pi contains the following mapping:
test_snake_in_ggg(x1, x2, x3)  =  test_snake_in_ggg(x1, x2, x3)
U1_ggg(x1, x2, x3, x4)  =  U1_ggg(x1, x2, x3, x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga(x1)
s(x1)  =  s(x1)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x1, x4)
U2_ggg(x1, x2, x3, x4, x5)  =  U2_ggg(x1, x2, x3, x5)
U3_ggg(x1, x2, x3, x4)  =  U3_ggg(x1, x2, x3, x4)
snake_in_gaa(x1, x2, x3)  =  snake_in_gaa(x1)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x1, x4)
infinite_snake_in_gaa(x1, x2, x3)  =  infinite_snake_in_gaa(x1)
[]  =  []
infinite_snake_out_gaa(x1, x2, x3)  =  infinite_snake_out_gaa(x1)
.(x1, x2)  =  .(x1, x2)
U8_gaa(x1, x2, x3, x4, x5)  =  U8_gaa(x1, x2, x5)
U6_gaa(x1, x2, x3, x4)  =  U6_gaa(x1, x4)
produce_snake_in_aaaa(x1, x2, x3, x4)  =  produce_snake_in_aaaa
produce_snake_out_aaaa(x1, x2, x3, x4)  =  produce_snake_out_aaaa
U9_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U9_aaaa(x7)
part_of_snake_in_aaaa(x1, x2, x3, x4)  =  part_of_snake_in_aaaa
part_of_snake_out_aaaa(x1, x2, x3, x4)  =  part_of_snake_out_aaaa
U11_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U11_aaaa(x7)
U10_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U10_aaaa(x7)
U7_gaa(x1, x2, x3, x4)  =  U7_gaa(x1, x4)
coil_it_in_ag(x1, x2)  =  coil_it_in_ag(x2)
coil_it_out_ag(x1, x2)  =  coil_it_out_ag(x2)
odd  =  odd
U12_ag(x1, x2, x3)  =  U12_ag(x3)
even  =  even
U13_ag(x1, x2, x3)  =  U13_ag(x3)
reverse2_in_aa(x1, x2)  =  reverse2_in_aa
U15_aa(x1, x2, x3)  =  U15_aa(x3)
reverse_in_aga(x1, x2, x3)  =  reverse_in_aga(x2)
reverse_out_aga(x1, x2, x3)  =  reverse_out_aga(x2)
U16_aga(x1, x2, x3, x4, x5)  =  U16_aga(x3, x5)
reverse_in_aaa(x1, x2, x3)  =  reverse_in_aaa
reverse_out_aaa(x1, x2, x3)  =  reverse_out_aaa
U16_aaa(x1, x2, x3, x4, x5)  =  U16_aaa(x5)
reverse2_out_aa(x1, x2)  =  reverse2_out_aa
U14_ag(x1, x2, x3)  =  U14_ag(x3)
snake_out_gaa(x1, x2, x3)  =  snake_out_gaa(x1)
test_snake_out_ggg(x1, x2, x3)  =  test_snake_out_ggg(x1, x2, x3)
U14_AG(x1, x2, x3)  =  U14_AG(x3)
S2L_IN_GA(x1, x2)  =  S2L_IN_GA(x1)
TEST_SNAKE_IN_GGG(x1, x2, x3)  =  TEST_SNAKE_IN_GGG(x1, x2, x3)
INFINITE_SNAKE_IN_GAA(x1, x2, x3)  =  INFINITE_SNAKE_IN_GAA(x1)
REVERSE_IN_AGA(x1, x2, x3)  =  REVERSE_IN_AGA(x2)
U1_GGG(x1, x2, x3, x4)  =  U1_GGG(x1, x2, x3, x4)
U4_GA(x1, x2, x3, x4)  =  U4_GA(x1, x4)
U3_GGG(x1, x2, x3, x4)  =  U3_GGG(x1, x2, x3, x4)
REVERSE2_IN_AA(x1, x2)  =  REVERSE2_IN_AA
U16_AGA(x1, x2, x3, x4, x5)  =  U16_AGA(x3, x5)
REVERSE_IN_AAA(x1, x2, x3)  =  REVERSE_IN_AAA
SNAKE_IN_GAA(x1, x2, x3)  =  SNAKE_IN_GAA(x1)
COIL_IT_IN_AG(x1, x2)  =  COIL_IT_IN_AG(x2)
PART_OF_SNAKE_IN_AAAA(x1, x2, x3, x4)  =  PART_OF_SNAKE_IN_AAAA
U9_AAAA(x1, x2, x3, x4, x5, x6, x7)  =  U9_AAAA(x7)
U16_AAA(x1, x2, x3, x4, x5)  =  U16_AAA(x5)
U10_AAAA(x1, x2, x3, x4, x5, x6, x7)  =  U10_AAAA(x7)
U5_GAA(x1, x2, x3, x4)  =  U5_GAA(x1, x4)
U11_AAAA(x1, x2, x3, x4, x5, x6, x7)  =  U11_AAAA(x7)
U8_GAA(x1, x2, x3, x4, x5)  =  U8_GAA(x1, x2, x5)
U13_AG(x1, x2, x3)  =  U13_AG(x3)
U6_GAA(x1, x2, x3, x4)  =  U6_GAA(x1, x4)
PRODUCE_SNAKE_IN_AAAA(x1, x2, x3, x4)  =  PRODUCE_SNAKE_IN_AAAA
U2_GGG(x1, x2, x3, x4, x5)  =  U2_GGG(x1, x2, x3, x5)
U15_AA(x1, x2, x3)  =  U15_AA(x3)
U12_AG(x1, x2, x3)  =  U12_AG(x3)
U7_GAA(x1, x2, x3, x4)  =  U7_GAA(x1, x4)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 6 SCCs with 25 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

REVERSE_IN_AAA(.(Head, Tail), SoFar, Reversed) → REVERSE_IN_AAA(Tail, .(Head, SoFar), Reversed)

The TRS R consists of the following rules:

test_snake_in_ggg(Pattern, C, R) → U1_ggg(Pattern, C, R, s2l_in_ga(C, Cols))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
s2l_in_ga(s(X), .(X1, Y)) → U4_ga(X, X1, Y, s2l_in_ga(X, Y))
U4_ga(X, X1, Y, s2l_out_ga(X, Y)) → s2l_out_ga(s(X), .(X1, Y))
U1_ggg(Pattern, C, R, s2l_out_ga(C, Cols)) → U2_ggg(Pattern, C, R, Cols, s2l_in_ga(R, Rows))
U2_ggg(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → U3_ggg(Pattern, C, R, snake_in_gaa(Pattern, Cols, Rows))
snake_in_gaa(Pattern, Cols, Rows) → U5_gaa(Pattern, Cols, Rows, infinite_snake_in_gaa(Pattern, InfSnake, InfSnake))
infinite_snake_in_gaa([], S, S) → infinite_snake_out_gaa([], S, S)
infinite_snake_in_gaa(.(A, R), .(A, T), S) → U8_gaa(A, R, T, S, infinite_snake_in_gaa(R, T, S))
U8_gaa(A, R, T, S, infinite_snake_out_gaa(R, T, S)) → infinite_snake_out_gaa(.(A, R), .(A, T), S)
U5_gaa(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → U6_gaa(Pattern, Cols, Rows, produce_snake_in_aaaa(Rows, Cols, InfSnake, Snake))
produce_snake_in_aaaa([], X, X1, []) → produce_snake_out_aaaa([], X, X1, [])
produce_snake_in_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
part_of_snake_in_aaaa([], RestSnake, RestSnake, []) → part_of_snake_out_aaaa([], RestSnake, RestSnake, [])
part_of_snake_in_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_out_aaaa(R, Rings, RestSnake, RestRings)) → part_of_snake_out_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings))
U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_in_aaaa(Rows, Cols, NewInfSnake, Tail))
U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_out_aaaa(Rows, Cols, NewInfSnake, Tail)) → produce_snake_out_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail))
U6_gaa(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → U7_gaa(Pattern, Cols, Rows, coil_it_in_ag(Snake, odd))
coil_it_in_ag([], X) → coil_it_out_ag([], X)
coil_it_in_ag(.(Line, Lines), odd) → U12_ag(Line, Lines, coil_it_in_ag(Lines, even))
coil_it_in_ag(.(Line, Lines), even) → U13_ag(Line, Lines, reverse2_in_aa(Line, Line1))
reverse2_in_aa(List, Reversed) → U15_aa(List, Reversed, reverse_in_aga(List, [], Reversed))
reverse_in_aga([], Reversed, Reversed) → reverse_out_aga([], Reversed, Reversed)
reverse_in_aga(.(Head, Tail), SoFar, Reversed) → U16_aga(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
reverse_in_aaa([], Reversed, Reversed) → reverse_out_aaa([], Reversed, Reversed)
reverse_in_aaa(.(Head, Tail), SoFar, Reversed) → U16_aaa(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
U16_aaa(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aaa(.(Head, Tail), SoFar, Reversed)
U16_aga(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aga(.(Head, Tail), SoFar, Reversed)
U15_aa(List, Reversed, reverse_out_aga(List, [], Reversed)) → reverse2_out_aa(List, Reversed)
U13_ag(Line, Lines, reverse2_out_aa(Line, Line1)) → U14_ag(Line, Lines, coil_it_in_ag(Lines, odd))
U14_ag(Line, Lines, coil_it_out_ag(Lines, odd)) → coil_it_out_ag(.(Line, Lines), even)
U12_ag(Line, Lines, coil_it_out_ag(Lines, even)) → coil_it_out_ag(.(Line, Lines), odd)
U7_gaa(Pattern, Cols, Rows, coil_it_out_ag(Snake, odd)) → snake_out_gaa(Pattern, Cols, Rows)
U3_ggg(Pattern, C, R, snake_out_gaa(Pattern, Cols, Rows)) → test_snake_out_ggg(Pattern, C, R)

The argument filtering Pi contains the following mapping:
test_snake_in_ggg(x1, x2, x3)  =  test_snake_in_ggg(x1, x2, x3)
U1_ggg(x1, x2, x3, x4)  =  U1_ggg(x1, x2, x3, x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga(x1)
s(x1)  =  s(x1)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x1, x4)
U2_ggg(x1, x2, x3, x4, x5)  =  U2_ggg(x1, x2, x3, x5)
U3_ggg(x1, x2, x3, x4)  =  U3_ggg(x1, x2, x3, x4)
snake_in_gaa(x1, x2, x3)  =  snake_in_gaa(x1)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x1, x4)
infinite_snake_in_gaa(x1, x2, x3)  =  infinite_snake_in_gaa(x1)
[]  =  []
infinite_snake_out_gaa(x1, x2, x3)  =  infinite_snake_out_gaa(x1)
.(x1, x2)  =  .(x1, x2)
U8_gaa(x1, x2, x3, x4, x5)  =  U8_gaa(x1, x2, x5)
U6_gaa(x1, x2, x3, x4)  =  U6_gaa(x1, x4)
produce_snake_in_aaaa(x1, x2, x3, x4)  =  produce_snake_in_aaaa
produce_snake_out_aaaa(x1, x2, x3, x4)  =  produce_snake_out_aaaa
U9_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U9_aaaa(x7)
part_of_snake_in_aaaa(x1, x2, x3, x4)  =  part_of_snake_in_aaaa
part_of_snake_out_aaaa(x1, x2, x3, x4)  =  part_of_snake_out_aaaa
U11_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U11_aaaa(x7)
U10_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U10_aaaa(x7)
U7_gaa(x1, x2, x3, x4)  =  U7_gaa(x1, x4)
coil_it_in_ag(x1, x2)  =  coil_it_in_ag(x2)
coil_it_out_ag(x1, x2)  =  coil_it_out_ag(x2)
odd  =  odd
U12_ag(x1, x2, x3)  =  U12_ag(x3)
even  =  even
U13_ag(x1, x2, x3)  =  U13_ag(x3)
reverse2_in_aa(x1, x2)  =  reverse2_in_aa
U15_aa(x1, x2, x3)  =  U15_aa(x3)
reverse_in_aga(x1, x2, x3)  =  reverse_in_aga(x2)
reverse_out_aga(x1, x2, x3)  =  reverse_out_aga(x2)
U16_aga(x1, x2, x3, x4, x5)  =  U16_aga(x3, x5)
reverse_in_aaa(x1, x2, x3)  =  reverse_in_aaa
reverse_out_aaa(x1, x2, x3)  =  reverse_out_aaa
U16_aaa(x1, x2, x3, x4, x5)  =  U16_aaa(x5)
reverse2_out_aa(x1, x2)  =  reverse2_out_aa
U14_ag(x1, x2, x3)  =  U14_ag(x3)
snake_out_gaa(x1, x2, x3)  =  snake_out_gaa(x1)
test_snake_out_ggg(x1, x2, x3)  =  test_snake_out_ggg(x1, x2, x3)
REVERSE_IN_AAA(x1, x2, x3)  =  REVERSE_IN_AAA

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

REVERSE_IN_AAA(.(Head, Tail), SoFar, Reversed) → REVERSE_IN_AAA(Tail, .(Head, SoFar), Reversed)

R is empty.
The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x1, x2)
REVERSE_IN_AAA(x1, x2, x3)  =  REVERSE_IN_AAA

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ NonTerminationProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

REVERSE_IN_AAAREVERSE_IN_AAA

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
We used the non-termination processor [17] to show that the DP problem is infinite.
Found a loop by semiunifying a rule from P directly.

The TRS P consists of the following rules:

REVERSE_IN_AAAREVERSE_IN_AAA

The TRS R consists of the following rules:none


s = REVERSE_IN_AAA evaluates to t =REVERSE_IN_AAA

Thus s starts an infinite chain as s semiunifies with t with the following substitutions:




Rewriting sequence

The DP semiunifies directly so there is only one rewrite step from REVERSE_IN_AAA to REVERSE_IN_AAA.





↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

COIL_IT_IN_AG(.(Line, Lines), odd) → COIL_IT_IN_AG(Lines, even)
COIL_IT_IN_AG(.(Line, Lines), even) → U13_AG(Line, Lines, reverse2_in_aa(Line, Line1))
U13_AG(Line, Lines, reverse2_out_aa(Line, Line1)) → COIL_IT_IN_AG(Lines, odd)

The TRS R consists of the following rules:

test_snake_in_ggg(Pattern, C, R) → U1_ggg(Pattern, C, R, s2l_in_ga(C, Cols))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
s2l_in_ga(s(X), .(X1, Y)) → U4_ga(X, X1, Y, s2l_in_ga(X, Y))
U4_ga(X, X1, Y, s2l_out_ga(X, Y)) → s2l_out_ga(s(X), .(X1, Y))
U1_ggg(Pattern, C, R, s2l_out_ga(C, Cols)) → U2_ggg(Pattern, C, R, Cols, s2l_in_ga(R, Rows))
U2_ggg(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → U3_ggg(Pattern, C, R, snake_in_gaa(Pattern, Cols, Rows))
snake_in_gaa(Pattern, Cols, Rows) → U5_gaa(Pattern, Cols, Rows, infinite_snake_in_gaa(Pattern, InfSnake, InfSnake))
infinite_snake_in_gaa([], S, S) → infinite_snake_out_gaa([], S, S)
infinite_snake_in_gaa(.(A, R), .(A, T), S) → U8_gaa(A, R, T, S, infinite_snake_in_gaa(R, T, S))
U8_gaa(A, R, T, S, infinite_snake_out_gaa(R, T, S)) → infinite_snake_out_gaa(.(A, R), .(A, T), S)
U5_gaa(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → U6_gaa(Pattern, Cols, Rows, produce_snake_in_aaaa(Rows, Cols, InfSnake, Snake))
produce_snake_in_aaaa([], X, X1, []) → produce_snake_out_aaaa([], X, X1, [])
produce_snake_in_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
part_of_snake_in_aaaa([], RestSnake, RestSnake, []) → part_of_snake_out_aaaa([], RestSnake, RestSnake, [])
part_of_snake_in_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_out_aaaa(R, Rings, RestSnake, RestRings)) → part_of_snake_out_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings))
U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_in_aaaa(Rows, Cols, NewInfSnake, Tail))
U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_out_aaaa(Rows, Cols, NewInfSnake, Tail)) → produce_snake_out_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail))
U6_gaa(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → U7_gaa(Pattern, Cols, Rows, coil_it_in_ag(Snake, odd))
coil_it_in_ag([], X) → coil_it_out_ag([], X)
coil_it_in_ag(.(Line, Lines), odd) → U12_ag(Line, Lines, coil_it_in_ag(Lines, even))
coil_it_in_ag(.(Line, Lines), even) → U13_ag(Line, Lines, reverse2_in_aa(Line, Line1))
reverse2_in_aa(List, Reversed) → U15_aa(List, Reversed, reverse_in_aga(List, [], Reversed))
reverse_in_aga([], Reversed, Reversed) → reverse_out_aga([], Reversed, Reversed)
reverse_in_aga(.(Head, Tail), SoFar, Reversed) → U16_aga(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
reverse_in_aaa([], Reversed, Reversed) → reverse_out_aaa([], Reversed, Reversed)
reverse_in_aaa(.(Head, Tail), SoFar, Reversed) → U16_aaa(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
U16_aaa(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aaa(.(Head, Tail), SoFar, Reversed)
U16_aga(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aga(.(Head, Tail), SoFar, Reversed)
U15_aa(List, Reversed, reverse_out_aga(List, [], Reversed)) → reverse2_out_aa(List, Reversed)
U13_ag(Line, Lines, reverse2_out_aa(Line, Line1)) → U14_ag(Line, Lines, coil_it_in_ag(Lines, odd))
U14_ag(Line, Lines, coil_it_out_ag(Lines, odd)) → coil_it_out_ag(.(Line, Lines), even)
U12_ag(Line, Lines, coil_it_out_ag(Lines, even)) → coil_it_out_ag(.(Line, Lines), odd)
U7_gaa(Pattern, Cols, Rows, coil_it_out_ag(Snake, odd)) → snake_out_gaa(Pattern, Cols, Rows)
U3_ggg(Pattern, C, R, snake_out_gaa(Pattern, Cols, Rows)) → test_snake_out_ggg(Pattern, C, R)

The argument filtering Pi contains the following mapping:
test_snake_in_ggg(x1, x2, x3)  =  test_snake_in_ggg(x1, x2, x3)
U1_ggg(x1, x2, x3, x4)  =  U1_ggg(x1, x2, x3, x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga(x1)
s(x1)  =  s(x1)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x1, x4)
U2_ggg(x1, x2, x3, x4, x5)  =  U2_ggg(x1, x2, x3, x5)
U3_ggg(x1, x2, x3, x4)  =  U3_ggg(x1, x2, x3, x4)
snake_in_gaa(x1, x2, x3)  =  snake_in_gaa(x1)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x1, x4)
infinite_snake_in_gaa(x1, x2, x3)  =  infinite_snake_in_gaa(x1)
[]  =  []
infinite_snake_out_gaa(x1, x2, x3)  =  infinite_snake_out_gaa(x1)
.(x1, x2)  =  .(x1, x2)
U8_gaa(x1, x2, x3, x4, x5)  =  U8_gaa(x1, x2, x5)
U6_gaa(x1, x2, x3, x4)  =  U6_gaa(x1, x4)
produce_snake_in_aaaa(x1, x2, x3, x4)  =  produce_snake_in_aaaa
produce_snake_out_aaaa(x1, x2, x3, x4)  =  produce_snake_out_aaaa
U9_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U9_aaaa(x7)
part_of_snake_in_aaaa(x1, x2, x3, x4)  =  part_of_snake_in_aaaa
part_of_snake_out_aaaa(x1, x2, x3, x4)  =  part_of_snake_out_aaaa
U11_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U11_aaaa(x7)
U10_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U10_aaaa(x7)
U7_gaa(x1, x2, x3, x4)  =  U7_gaa(x1, x4)
coil_it_in_ag(x1, x2)  =  coil_it_in_ag(x2)
coil_it_out_ag(x1, x2)  =  coil_it_out_ag(x2)
odd  =  odd
U12_ag(x1, x2, x3)  =  U12_ag(x3)
even  =  even
U13_ag(x1, x2, x3)  =  U13_ag(x3)
reverse2_in_aa(x1, x2)  =  reverse2_in_aa
U15_aa(x1, x2, x3)  =  U15_aa(x3)
reverse_in_aga(x1, x2, x3)  =  reverse_in_aga(x2)
reverse_out_aga(x1, x2, x3)  =  reverse_out_aga(x2)
U16_aga(x1, x2, x3, x4, x5)  =  U16_aga(x3, x5)
reverse_in_aaa(x1, x2, x3)  =  reverse_in_aaa
reverse_out_aaa(x1, x2, x3)  =  reverse_out_aaa
U16_aaa(x1, x2, x3, x4, x5)  =  U16_aaa(x5)
reverse2_out_aa(x1, x2)  =  reverse2_out_aa
U14_ag(x1, x2, x3)  =  U14_ag(x3)
snake_out_gaa(x1, x2, x3)  =  snake_out_gaa(x1)
test_snake_out_ggg(x1, x2, x3)  =  test_snake_out_ggg(x1, x2, x3)
COIL_IT_IN_AG(x1, x2)  =  COIL_IT_IN_AG(x2)
U13_AG(x1, x2, x3)  =  U13_AG(x3)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

COIL_IT_IN_AG(.(Line, Lines), odd) → COIL_IT_IN_AG(Lines, even)
COIL_IT_IN_AG(.(Line, Lines), even) → U13_AG(Line, Lines, reverse2_in_aa(Line, Line1))
U13_AG(Line, Lines, reverse2_out_aa(Line, Line1)) → COIL_IT_IN_AG(Lines, odd)

The TRS R consists of the following rules:

reverse2_in_aa(List, Reversed) → U15_aa(List, Reversed, reverse_in_aga(List, [], Reversed))
U15_aa(List, Reversed, reverse_out_aga(List, [], Reversed)) → reverse2_out_aa(List, Reversed)
reverse_in_aga([], Reversed, Reversed) → reverse_out_aga([], Reversed, Reversed)
reverse_in_aga(.(Head, Tail), SoFar, Reversed) → U16_aga(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
U16_aga(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aga(.(Head, Tail), SoFar, Reversed)
reverse_in_aaa([], Reversed, Reversed) → reverse_out_aaa([], Reversed, Reversed)
reverse_in_aaa(.(Head, Tail), SoFar, Reversed) → U16_aaa(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
U16_aaa(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aaa(.(Head, Tail), SoFar, Reversed)

The argument filtering Pi contains the following mapping:
[]  =  []
.(x1, x2)  =  .(x1, x2)
odd  =  odd
even  =  even
reverse2_in_aa(x1, x2)  =  reverse2_in_aa
U15_aa(x1, x2, x3)  =  U15_aa(x3)
reverse_in_aga(x1, x2, x3)  =  reverse_in_aga(x2)
reverse_out_aga(x1, x2, x3)  =  reverse_out_aga(x2)
U16_aga(x1, x2, x3, x4, x5)  =  U16_aga(x3, x5)
reverse_in_aaa(x1, x2, x3)  =  reverse_in_aaa
reverse_out_aaa(x1, x2, x3)  =  reverse_out_aaa
U16_aaa(x1, x2, x3, x4, x5)  =  U16_aaa(x5)
reverse2_out_aa(x1, x2)  =  reverse2_out_aa
COIL_IT_IN_AG(x1, x2)  =  COIL_IT_IN_AG(x2)
U13_AG(x1, x2, x3)  =  U13_AG(x3)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ Narrowing
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

COIL_IT_IN_AG(odd) → COIL_IT_IN_AG(even)
COIL_IT_IN_AG(even) → U13_AG(reverse2_in_aa)
U13_AG(reverse2_out_aa) → COIL_IT_IN_AG(odd)

The TRS R consists of the following rules:

reverse2_in_aaU15_aa(reverse_in_aga([]))
U15_aa(reverse_out_aga([])) → reverse2_out_aa
reverse_in_aga(Reversed) → reverse_out_aga(Reversed)
reverse_in_aga(SoFar) → U16_aga(SoFar, reverse_in_aaa)
U16_aga(SoFar, reverse_out_aaa) → reverse_out_aga(SoFar)
reverse_in_aaareverse_out_aaa
reverse_in_aaaU16_aaa(reverse_in_aaa)
U16_aaa(reverse_out_aaa) → reverse_out_aaa

The set Q consists of the following terms:

reverse2_in_aa
U15_aa(x0)
reverse_in_aga(x0)
U16_aga(x0, x1)
reverse_in_aaa
U16_aaa(x0)

We have to consider all (P,Q,R)-chains.
By narrowing [15] the rule COIL_IT_IN_AG(even) → U13_AG(reverse2_in_aa) at position [0] we obtained the following new rules:

COIL_IT_IN_AG(even) → U13_AG(U15_aa(reverse_in_aga([])))



↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ Narrowing
QDP
                            ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

COIL_IT_IN_AG(odd) → COIL_IT_IN_AG(even)
COIL_IT_IN_AG(even) → U13_AG(U15_aa(reverse_in_aga([])))
U13_AG(reverse2_out_aa) → COIL_IT_IN_AG(odd)

The TRS R consists of the following rules:

reverse2_in_aaU15_aa(reverse_in_aga([]))
U15_aa(reverse_out_aga([])) → reverse2_out_aa
reverse_in_aga(Reversed) → reverse_out_aga(Reversed)
reverse_in_aga(SoFar) → U16_aga(SoFar, reverse_in_aaa)
U16_aga(SoFar, reverse_out_aaa) → reverse_out_aga(SoFar)
reverse_in_aaareverse_out_aaa
reverse_in_aaaU16_aaa(reverse_in_aaa)
U16_aaa(reverse_out_aaa) → reverse_out_aaa

The set Q consists of the following terms:

reverse2_in_aa
U15_aa(x0)
reverse_in_aga(x0)
U16_aga(x0, x1)
reverse_in_aaa
U16_aaa(x0)

We have to consider all (P,Q,R)-chains.
As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [15] we can delete all non-usable rules [17] from R.

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ Narrowing
                          ↳ QDP
                            ↳ UsableRulesProof
QDP
                                ↳ QReductionProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

COIL_IT_IN_AG(odd) → COIL_IT_IN_AG(even)
COIL_IT_IN_AG(even) → U13_AG(U15_aa(reverse_in_aga([])))
U13_AG(reverse2_out_aa) → COIL_IT_IN_AG(odd)

The TRS R consists of the following rules:

reverse_in_aga(Reversed) → reverse_out_aga(Reversed)
reverse_in_aga(SoFar) → U16_aga(SoFar, reverse_in_aaa)
U15_aa(reverse_out_aga([])) → reverse2_out_aa
reverse_in_aaareverse_out_aaa
reverse_in_aaaU16_aaa(reverse_in_aaa)
U16_aga(SoFar, reverse_out_aaa) → reverse_out_aga(SoFar)
U16_aaa(reverse_out_aaa) → reverse_out_aaa

The set Q consists of the following terms:

reverse2_in_aa
U15_aa(x0)
reverse_in_aga(x0)
U16_aga(x0, x1)
reverse_in_aaa
U16_aaa(x0)

We have to consider all (P,Q,R)-chains.
We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.

reverse2_in_aa



↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ Narrowing
                          ↳ QDP
                            ↳ UsableRulesProof
                              ↳ QDP
                                ↳ QReductionProof
QDP
                                    ↳ NonTerminationProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

COIL_IT_IN_AG(odd) → COIL_IT_IN_AG(even)
COIL_IT_IN_AG(even) → U13_AG(U15_aa(reverse_in_aga([])))
U13_AG(reverse2_out_aa) → COIL_IT_IN_AG(odd)

The TRS R consists of the following rules:

reverse_in_aga(Reversed) → reverse_out_aga(Reversed)
reverse_in_aga(SoFar) → U16_aga(SoFar, reverse_in_aaa)
U15_aa(reverse_out_aga([])) → reverse2_out_aa
reverse_in_aaareverse_out_aaa
reverse_in_aaaU16_aaa(reverse_in_aaa)
U16_aga(SoFar, reverse_out_aaa) → reverse_out_aga(SoFar)
U16_aaa(reverse_out_aaa) → reverse_out_aaa

The set Q consists of the following terms:

U15_aa(x0)
reverse_in_aga(x0)
U16_aga(x0, x1)
reverse_in_aaa
U16_aaa(x0)

We have to consider all (P,Q,R)-chains.
We used the non-termination processor [17] to show that the DP problem is infinite.
Found a loop by narrowing to the left:

The TRS P consists of the following rules:

COIL_IT_IN_AG(odd) → COIL_IT_IN_AG(even)
COIL_IT_IN_AG(even) → U13_AG(U15_aa(reverse_in_aga([])))
U13_AG(reverse2_out_aa) → COIL_IT_IN_AG(odd)

The TRS R consists of the following rules:

reverse_in_aga(Reversed) → reverse_out_aga(Reversed)
reverse_in_aga(SoFar) → U16_aga(SoFar, reverse_in_aaa)
U15_aa(reverse_out_aga([])) → reverse2_out_aa
reverse_in_aaareverse_out_aaa
reverse_in_aaaU16_aaa(reverse_in_aaa)
U16_aga(SoFar, reverse_out_aaa) → reverse_out_aga(SoFar)
U16_aaa(reverse_out_aaa) → reverse_out_aaa


s = U13_AG(U15_aa(reverse_in_aga([]))) evaluates to t =U13_AG(U15_aa(reverse_in_aga([])))

Thus s starts an infinite chain as s semiunifies with t with the following substitutions:




Rewriting sequence

U13_AG(U15_aa(reverse_in_aga([])))U13_AG(U15_aa(reverse_out_aga([])))
with rule reverse_in_aga(Reversed) → reverse_out_aga(Reversed) at position [0,0] and matcher [Reversed / []]

U13_AG(U15_aa(reverse_out_aga([])))U13_AG(reverse2_out_aa)
with rule U15_aa(reverse_out_aga([])) → reverse2_out_aa at position [0] and matcher [ ]

U13_AG(reverse2_out_aa)COIL_IT_IN_AG(odd)
with rule U13_AG(reverse2_out_aa) → COIL_IT_IN_AG(odd) at position [] and matcher [ ]

COIL_IT_IN_AG(odd)COIL_IT_IN_AG(even)
with rule COIL_IT_IN_AG(odd) → COIL_IT_IN_AG(even) at position [] and matcher [ ]

COIL_IT_IN_AG(even)U13_AG(U15_aa(reverse_in_aga([])))
with rule COIL_IT_IN_AG(even) → U13_AG(U15_aa(reverse_in_aga([])))

Now applying the matcher to the start term leads to a term which is equal to the last term in the rewriting sequence


All these steps are and every following step will be a correct step w.r.t to Q.





↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

PART_OF_SNAKE_IN_AAAA(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → PART_OF_SNAKE_IN_AAAA(R, Rings, RestSnake, RestRings)

The TRS R consists of the following rules:

test_snake_in_ggg(Pattern, C, R) → U1_ggg(Pattern, C, R, s2l_in_ga(C, Cols))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
s2l_in_ga(s(X), .(X1, Y)) → U4_ga(X, X1, Y, s2l_in_ga(X, Y))
U4_ga(X, X1, Y, s2l_out_ga(X, Y)) → s2l_out_ga(s(X), .(X1, Y))
U1_ggg(Pattern, C, R, s2l_out_ga(C, Cols)) → U2_ggg(Pattern, C, R, Cols, s2l_in_ga(R, Rows))
U2_ggg(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → U3_ggg(Pattern, C, R, snake_in_gaa(Pattern, Cols, Rows))
snake_in_gaa(Pattern, Cols, Rows) → U5_gaa(Pattern, Cols, Rows, infinite_snake_in_gaa(Pattern, InfSnake, InfSnake))
infinite_snake_in_gaa([], S, S) → infinite_snake_out_gaa([], S, S)
infinite_snake_in_gaa(.(A, R), .(A, T), S) → U8_gaa(A, R, T, S, infinite_snake_in_gaa(R, T, S))
U8_gaa(A, R, T, S, infinite_snake_out_gaa(R, T, S)) → infinite_snake_out_gaa(.(A, R), .(A, T), S)
U5_gaa(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → U6_gaa(Pattern, Cols, Rows, produce_snake_in_aaaa(Rows, Cols, InfSnake, Snake))
produce_snake_in_aaaa([], X, X1, []) → produce_snake_out_aaaa([], X, X1, [])
produce_snake_in_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
part_of_snake_in_aaaa([], RestSnake, RestSnake, []) → part_of_snake_out_aaaa([], RestSnake, RestSnake, [])
part_of_snake_in_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_out_aaaa(R, Rings, RestSnake, RestRings)) → part_of_snake_out_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings))
U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_in_aaaa(Rows, Cols, NewInfSnake, Tail))
U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_out_aaaa(Rows, Cols, NewInfSnake, Tail)) → produce_snake_out_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail))
U6_gaa(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → U7_gaa(Pattern, Cols, Rows, coil_it_in_ag(Snake, odd))
coil_it_in_ag([], X) → coil_it_out_ag([], X)
coil_it_in_ag(.(Line, Lines), odd) → U12_ag(Line, Lines, coil_it_in_ag(Lines, even))
coil_it_in_ag(.(Line, Lines), even) → U13_ag(Line, Lines, reverse2_in_aa(Line, Line1))
reverse2_in_aa(List, Reversed) → U15_aa(List, Reversed, reverse_in_aga(List, [], Reversed))
reverse_in_aga([], Reversed, Reversed) → reverse_out_aga([], Reversed, Reversed)
reverse_in_aga(.(Head, Tail), SoFar, Reversed) → U16_aga(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
reverse_in_aaa([], Reversed, Reversed) → reverse_out_aaa([], Reversed, Reversed)
reverse_in_aaa(.(Head, Tail), SoFar, Reversed) → U16_aaa(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
U16_aaa(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aaa(.(Head, Tail), SoFar, Reversed)
U16_aga(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aga(.(Head, Tail), SoFar, Reversed)
U15_aa(List, Reversed, reverse_out_aga(List, [], Reversed)) → reverse2_out_aa(List, Reversed)
U13_ag(Line, Lines, reverse2_out_aa(Line, Line1)) → U14_ag(Line, Lines, coil_it_in_ag(Lines, odd))
U14_ag(Line, Lines, coil_it_out_ag(Lines, odd)) → coil_it_out_ag(.(Line, Lines), even)
U12_ag(Line, Lines, coil_it_out_ag(Lines, even)) → coil_it_out_ag(.(Line, Lines), odd)
U7_gaa(Pattern, Cols, Rows, coil_it_out_ag(Snake, odd)) → snake_out_gaa(Pattern, Cols, Rows)
U3_ggg(Pattern, C, R, snake_out_gaa(Pattern, Cols, Rows)) → test_snake_out_ggg(Pattern, C, R)

The argument filtering Pi contains the following mapping:
test_snake_in_ggg(x1, x2, x3)  =  test_snake_in_ggg(x1, x2, x3)
U1_ggg(x1, x2, x3, x4)  =  U1_ggg(x1, x2, x3, x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga(x1)
s(x1)  =  s(x1)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x1, x4)
U2_ggg(x1, x2, x3, x4, x5)  =  U2_ggg(x1, x2, x3, x5)
U3_ggg(x1, x2, x3, x4)  =  U3_ggg(x1, x2, x3, x4)
snake_in_gaa(x1, x2, x3)  =  snake_in_gaa(x1)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x1, x4)
infinite_snake_in_gaa(x1, x2, x3)  =  infinite_snake_in_gaa(x1)
[]  =  []
infinite_snake_out_gaa(x1, x2, x3)  =  infinite_snake_out_gaa(x1)
.(x1, x2)  =  .(x1, x2)
U8_gaa(x1, x2, x3, x4, x5)  =  U8_gaa(x1, x2, x5)
U6_gaa(x1, x2, x3, x4)  =  U6_gaa(x1, x4)
produce_snake_in_aaaa(x1, x2, x3, x4)  =  produce_snake_in_aaaa
produce_snake_out_aaaa(x1, x2, x3, x4)  =  produce_snake_out_aaaa
U9_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U9_aaaa(x7)
part_of_snake_in_aaaa(x1, x2, x3, x4)  =  part_of_snake_in_aaaa
part_of_snake_out_aaaa(x1, x2, x3, x4)  =  part_of_snake_out_aaaa
U11_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U11_aaaa(x7)
U10_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U10_aaaa(x7)
U7_gaa(x1, x2, x3, x4)  =  U7_gaa(x1, x4)
coil_it_in_ag(x1, x2)  =  coil_it_in_ag(x2)
coil_it_out_ag(x1, x2)  =  coil_it_out_ag(x2)
odd  =  odd
U12_ag(x1, x2, x3)  =  U12_ag(x3)
even  =  even
U13_ag(x1, x2, x3)  =  U13_ag(x3)
reverse2_in_aa(x1, x2)  =  reverse2_in_aa
U15_aa(x1, x2, x3)  =  U15_aa(x3)
reverse_in_aga(x1, x2, x3)  =  reverse_in_aga(x2)
reverse_out_aga(x1, x2, x3)  =  reverse_out_aga(x2)
U16_aga(x1, x2, x3, x4, x5)  =  U16_aga(x3, x5)
reverse_in_aaa(x1, x2, x3)  =  reverse_in_aaa
reverse_out_aaa(x1, x2, x3)  =  reverse_out_aaa
U16_aaa(x1, x2, x3, x4, x5)  =  U16_aaa(x5)
reverse2_out_aa(x1, x2)  =  reverse2_out_aa
U14_ag(x1, x2, x3)  =  U14_ag(x3)
snake_out_gaa(x1, x2, x3)  =  snake_out_gaa(x1)
test_snake_out_ggg(x1, x2, x3)  =  test_snake_out_ggg(x1, x2, x3)
PART_OF_SNAKE_IN_AAAA(x1, x2, x3, x4)  =  PART_OF_SNAKE_IN_AAAA

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

PART_OF_SNAKE_IN_AAAA(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → PART_OF_SNAKE_IN_AAAA(R, Rings, RestSnake, RestRings)

R is empty.
The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x1, x2)
PART_OF_SNAKE_IN_AAAA(x1, x2, x3, x4)  =  PART_OF_SNAKE_IN_AAAA

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ NonTerminationProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

PART_OF_SNAKE_IN_AAAAPART_OF_SNAKE_IN_AAAA

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
We used the non-termination processor [17] to show that the DP problem is infinite.
Found a loop by semiunifying a rule from P directly.

The TRS P consists of the following rules:

PART_OF_SNAKE_IN_AAAAPART_OF_SNAKE_IN_AAAA

The TRS R consists of the following rules:none


s = PART_OF_SNAKE_IN_AAAA evaluates to t =PART_OF_SNAKE_IN_AAAA

Thus s starts an infinite chain as s semiunifies with t with the following substitutions:




Rewriting sequence

The DP semiunifies directly so there is only one rewrite step from PART_OF_SNAKE_IN_AAAA to PART_OF_SNAKE_IN_AAAA.





↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

PRODUCE_SNAKE_IN_AAAA(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_AAAA(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
U9_AAAA(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → PRODUCE_SNAKE_IN_AAAA(Rows, Cols, NewInfSnake, Tail)

The TRS R consists of the following rules:

test_snake_in_ggg(Pattern, C, R) → U1_ggg(Pattern, C, R, s2l_in_ga(C, Cols))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
s2l_in_ga(s(X), .(X1, Y)) → U4_ga(X, X1, Y, s2l_in_ga(X, Y))
U4_ga(X, X1, Y, s2l_out_ga(X, Y)) → s2l_out_ga(s(X), .(X1, Y))
U1_ggg(Pattern, C, R, s2l_out_ga(C, Cols)) → U2_ggg(Pattern, C, R, Cols, s2l_in_ga(R, Rows))
U2_ggg(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → U3_ggg(Pattern, C, R, snake_in_gaa(Pattern, Cols, Rows))
snake_in_gaa(Pattern, Cols, Rows) → U5_gaa(Pattern, Cols, Rows, infinite_snake_in_gaa(Pattern, InfSnake, InfSnake))
infinite_snake_in_gaa([], S, S) → infinite_snake_out_gaa([], S, S)
infinite_snake_in_gaa(.(A, R), .(A, T), S) → U8_gaa(A, R, T, S, infinite_snake_in_gaa(R, T, S))
U8_gaa(A, R, T, S, infinite_snake_out_gaa(R, T, S)) → infinite_snake_out_gaa(.(A, R), .(A, T), S)
U5_gaa(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → U6_gaa(Pattern, Cols, Rows, produce_snake_in_aaaa(Rows, Cols, InfSnake, Snake))
produce_snake_in_aaaa([], X, X1, []) → produce_snake_out_aaaa([], X, X1, [])
produce_snake_in_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
part_of_snake_in_aaaa([], RestSnake, RestSnake, []) → part_of_snake_out_aaaa([], RestSnake, RestSnake, [])
part_of_snake_in_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_out_aaaa(R, Rings, RestSnake, RestRings)) → part_of_snake_out_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings))
U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_in_aaaa(Rows, Cols, NewInfSnake, Tail))
U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_out_aaaa(Rows, Cols, NewInfSnake, Tail)) → produce_snake_out_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail))
U6_gaa(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → U7_gaa(Pattern, Cols, Rows, coil_it_in_ag(Snake, odd))
coil_it_in_ag([], X) → coil_it_out_ag([], X)
coil_it_in_ag(.(Line, Lines), odd) → U12_ag(Line, Lines, coil_it_in_ag(Lines, even))
coil_it_in_ag(.(Line, Lines), even) → U13_ag(Line, Lines, reverse2_in_aa(Line, Line1))
reverse2_in_aa(List, Reversed) → U15_aa(List, Reversed, reverse_in_aga(List, [], Reversed))
reverse_in_aga([], Reversed, Reversed) → reverse_out_aga([], Reversed, Reversed)
reverse_in_aga(.(Head, Tail), SoFar, Reversed) → U16_aga(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
reverse_in_aaa([], Reversed, Reversed) → reverse_out_aaa([], Reversed, Reversed)
reverse_in_aaa(.(Head, Tail), SoFar, Reversed) → U16_aaa(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
U16_aaa(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aaa(.(Head, Tail), SoFar, Reversed)
U16_aga(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aga(.(Head, Tail), SoFar, Reversed)
U15_aa(List, Reversed, reverse_out_aga(List, [], Reversed)) → reverse2_out_aa(List, Reversed)
U13_ag(Line, Lines, reverse2_out_aa(Line, Line1)) → U14_ag(Line, Lines, coil_it_in_ag(Lines, odd))
U14_ag(Line, Lines, coil_it_out_ag(Lines, odd)) → coil_it_out_ag(.(Line, Lines), even)
U12_ag(Line, Lines, coil_it_out_ag(Lines, even)) → coil_it_out_ag(.(Line, Lines), odd)
U7_gaa(Pattern, Cols, Rows, coil_it_out_ag(Snake, odd)) → snake_out_gaa(Pattern, Cols, Rows)
U3_ggg(Pattern, C, R, snake_out_gaa(Pattern, Cols, Rows)) → test_snake_out_ggg(Pattern, C, R)

The argument filtering Pi contains the following mapping:
test_snake_in_ggg(x1, x2, x3)  =  test_snake_in_ggg(x1, x2, x3)
U1_ggg(x1, x2, x3, x4)  =  U1_ggg(x1, x2, x3, x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga(x1)
s(x1)  =  s(x1)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x1, x4)
U2_ggg(x1, x2, x3, x4, x5)  =  U2_ggg(x1, x2, x3, x5)
U3_ggg(x1, x2, x3, x4)  =  U3_ggg(x1, x2, x3, x4)
snake_in_gaa(x1, x2, x3)  =  snake_in_gaa(x1)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x1, x4)
infinite_snake_in_gaa(x1, x2, x3)  =  infinite_snake_in_gaa(x1)
[]  =  []
infinite_snake_out_gaa(x1, x2, x3)  =  infinite_snake_out_gaa(x1)
.(x1, x2)  =  .(x1, x2)
U8_gaa(x1, x2, x3, x4, x5)  =  U8_gaa(x1, x2, x5)
U6_gaa(x1, x2, x3, x4)  =  U6_gaa(x1, x4)
produce_snake_in_aaaa(x1, x2, x3, x4)  =  produce_snake_in_aaaa
produce_snake_out_aaaa(x1, x2, x3, x4)  =  produce_snake_out_aaaa
U9_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U9_aaaa(x7)
part_of_snake_in_aaaa(x1, x2, x3, x4)  =  part_of_snake_in_aaaa
part_of_snake_out_aaaa(x1, x2, x3, x4)  =  part_of_snake_out_aaaa
U11_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U11_aaaa(x7)
U10_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U10_aaaa(x7)
U7_gaa(x1, x2, x3, x4)  =  U7_gaa(x1, x4)
coil_it_in_ag(x1, x2)  =  coil_it_in_ag(x2)
coil_it_out_ag(x1, x2)  =  coil_it_out_ag(x2)
odd  =  odd
U12_ag(x1, x2, x3)  =  U12_ag(x3)
even  =  even
U13_ag(x1, x2, x3)  =  U13_ag(x3)
reverse2_in_aa(x1, x2)  =  reverse2_in_aa
U15_aa(x1, x2, x3)  =  U15_aa(x3)
reverse_in_aga(x1, x2, x3)  =  reverse_in_aga(x2)
reverse_out_aga(x1, x2, x3)  =  reverse_out_aga(x2)
U16_aga(x1, x2, x3, x4, x5)  =  U16_aga(x3, x5)
reverse_in_aaa(x1, x2, x3)  =  reverse_in_aaa
reverse_out_aaa(x1, x2, x3)  =  reverse_out_aaa
U16_aaa(x1, x2, x3, x4, x5)  =  U16_aaa(x5)
reverse2_out_aa(x1, x2)  =  reverse2_out_aa
U14_ag(x1, x2, x3)  =  U14_ag(x3)
snake_out_gaa(x1, x2, x3)  =  snake_out_gaa(x1)
test_snake_out_ggg(x1, x2, x3)  =  test_snake_out_ggg(x1, x2, x3)
U9_AAAA(x1, x2, x3, x4, x5, x6, x7)  =  U9_AAAA(x7)
PRODUCE_SNAKE_IN_AAAA(x1, x2, x3, x4)  =  PRODUCE_SNAKE_IN_AAAA

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

PRODUCE_SNAKE_IN_AAAA(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_AAAA(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
U9_AAAA(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → PRODUCE_SNAKE_IN_AAAA(Rows, Cols, NewInfSnake, Tail)

The TRS R consists of the following rules:

part_of_snake_in_aaaa([], RestSnake, RestSnake, []) → part_of_snake_out_aaaa([], RestSnake, RestSnake, [])
part_of_snake_in_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_out_aaaa(R, Rings, RestSnake, RestRings)) → part_of_snake_out_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings))

The argument filtering Pi contains the following mapping:
[]  =  []
.(x1, x2)  =  .(x1, x2)
part_of_snake_in_aaaa(x1, x2, x3, x4)  =  part_of_snake_in_aaaa
part_of_snake_out_aaaa(x1, x2, x3, x4)  =  part_of_snake_out_aaaa
U11_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U11_aaaa(x7)
U9_AAAA(x1, x2, x3, x4, x5, x6, x7)  =  U9_AAAA(x7)
PRODUCE_SNAKE_IN_AAAA(x1, x2, x3, x4)  =  PRODUCE_SNAKE_IN_AAAA

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ Narrowing
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

U9_AAAA(part_of_snake_out_aaaa) → PRODUCE_SNAKE_IN_AAAA
PRODUCE_SNAKE_IN_AAAAU9_AAAA(part_of_snake_in_aaaa)

The TRS R consists of the following rules:

part_of_snake_in_aaaapart_of_snake_out_aaaa
part_of_snake_in_aaaaU11_aaaa(part_of_snake_in_aaaa)
U11_aaaa(part_of_snake_out_aaaa) → part_of_snake_out_aaaa

The set Q consists of the following terms:

part_of_snake_in_aaaa
U11_aaaa(x0)

We have to consider all (P,Q,R)-chains.
By narrowing [15] the rule PRODUCE_SNAKE_IN_AAAAU9_AAAA(part_of_snake_in_aaaa) at position [0] we obtained the following new rules:

PRODUCE_SNAKE_IN_AAAAU9_AAAA(U11_aaaa(part_of_snake_in_aaaa))
PRODUCE_SNAKE_IN_AAAAU9_AAAA(part_of_snake_out_aaaa)



↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ Narrowing
QDP
                            ↳ NonTerminationProof
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

PRODUCE_SNAKE_IN_AAAAU9_AAAA(U11_aaaa(part_of_snake_in_aaaa))
PRODUCE_SNAKE_IN_AAAAU9_AAAA(part_of_snake_out_aaaa)
U9_AAAA(part_of_snake_out_aaaa) → PRODUCE_SNAKE_IN_AAAA

The TRS R consists of the following rules:

part_of_snake_in_aaaapart_of_snake_out_aaaa
part_of_snake_in_aaaaU11_aaaa(part_of_snake_in_aaaa)
U11_aaaa(part_of_snake_out_aaaa) → part_of_snake_out_aaaa

The set Q consists of the following terms:

part_of_snake_in_aaaa
U11_aaaa(x0)

We have to consider all (P,Q,R)-chains.
We used the non-termination processor [17] to show that the DP problem is infinite.
Found a loop by narrowing to the left:

The TRS P consists of the following rules:

PRODUCE_SNAKE_IN_AAAAU9_AAAA(U11_aaaa(part_of_snake_in_aaaa))
PRODUCE_SNAKE_IN_AAAAU9_AAAA(part_of_snake_out_aaaa)
U9_AAAA(part_of_snake_out_aaaa) → PRODUCE_SNAKE_IN_AAAA

The TRS R consists of the following rules:

part_of_snake_in_aaaapart_of_snake_out_aaaa
part_of_snake_in_aaaaU11_aaaa(part_of_snake_in_aaaa)
U11_aaaa(part_of_snake_out_aaaa) → part_of_snake_out_aaaa


s = U9_AAAA(part_of_snake_out_aaaa) evaluates to t =U9_AAAA(part_of_snake_out_aaaa)

Thus s starts an infinite chain as s semiunifies with t with the following substitutions:




Rewriting sequence

U9_AAAA(part_of_snake_out_aaaa)PRODUCE_SNAKE_IN_AAAA
with rule U9_AAAA(part_of_snake_out_aaaa) → PRODUCE_SNAKE_IN_AAAA at position [] and matcher [ ]

PRODUCE_SNAKE_IN_AAAAU9_AAAA(part_of_snake_out_aaaa)
with rule PRODUCE_SNAKE_IN_AAAAU9_AAAA(part_of_snake_out_aaaa)

Now applying the matcher to the start term leads to a term which is equal to the last term in the rewriting sequence


All these steps are and every following step will be a correct step w.r.t to Q.





↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

INFINITE_SNAKE_IN_GAA(.(A, R), .(A, T), S) → INFINITE_SNAKE_IN_GAA(R, T, S)

The TRS R consists of the following rules:

test_snake_in_ggg(Pattern, C, R) → U1_ggg(Pattern, C, R, s2l_in_ga(C, Cols))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
s2l_in_ga(s(X), .(X1, Y)) → U4_ga(X, X1, Y, s2l_in_ga(X, Y))
U4_ga(X, X1, Y, s2l_out_ga(X, Y)) → s2l_out_ga(s(X), .(X1, Y))
U1_ggg(Pattern, C, R, s2l_out_ga(C, Cols)) → U2_ggg(Pattern, C, R, Cols, s2l_in_ga(R, Rows))
U2_ggg(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → U3_ggg(Pattern, C, R, snake_in_gaa(Pattern, Cols, Rows))
snake_in_gaa(Pattern, Cols, Rows) → U5_gaa(Pattern, Cols, Rows, infinite_snake_in_gaa(Pattern, InfSnake, InfSnake))
infinite_snake_in_gaa([], S, S) → infinite_snake_out_gaa([], S, S)
infinite_snake_in_gaa(.(A, R), .(A, T), S) → U8_gaa(A, R, T, S, infinite_snake_in_gaa(R, T, S))
U8_gaa(A, R, T, S, infinite_snake_out_gaa(R, T, S)) → infinite_snake_out_gaa(.(A, R), .(A, T), S)
U5_gaa(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → U6_gaa(Pattern, Cols, Rows, produce_snake_in_aaaa(Rows, Cols, InfSnake, Snake))
produce_snake_in_aaaa([], X, X1, []) → produce_snake_out_aaaa([], X, X1, [])
produce_snake_in_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
part_of_snake_in_aaaa([], RestSnake, RestSnake, []) → part_of_snake_out_aaaa([], RestSnake, RestSnake, [])
part_of_snake_in_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_out_aaaa(R, Rings, RestSnake, RestRings)) → part_of_snake_out_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings))
U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_in_aaaa(Rows, Cols, NewInfSnake, Tail))
U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_out_aaaa(Rows, Cols, NewInfSnake, Tail)) → produce_snake_out_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail))
U6_gaa(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → U7_gaa(Pattern, Cols, Rows, coil_it_in_ag(Snake, odd))
coil_it_in_ag([], X) → coil_it_out_ag([], X)
coil_it_in_ag(.(Line, Lines), odd) → U12_ag(Line, Lines, coil_it_in_ag(Lines, even))
coil_it_in_ag(.(Line, Lines), even) → U13_ag(Line, Lines, reverse2_in_aa(Line, Line1))
reverse2_in_aa(List, Reversed) → U15_aa(List, Reversed, reverse_in_aga(List, [], Reversed))
reverse_in_aga([], Reversed, Reversed) → reverse_out_aga([], Reversed, Reversed)
reverse_in_aga(.(Head, Tail), SoFar, Reversed) → U16_aga(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
reverse_in_aaa([], Reversed, Reversed) → reverse_out_aaa([], Reversed, Reversed)
reverse_in_aaa(.(Head, Tail), SoFar, Reversed) → U16_aaa(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
U16_aaa(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aaa(.(Head, Tail), SoFar, Reversed)
U16_aga(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aga(.(Head, Tail), SoFar, Reversed)
U15_aa(List, Reversed, reverse_out_aga(List, [], Reversed)) → reverse2_out_aa(List, Reversed)
U13_ag(Line, Lines, reverse2_out_aa(Line, Line1)) → U14_ag(Line, Lines, coil_it_in_ag(Lines, odd))
U14_ag(Line, Lines, coil_it_out_ag(Lines, odd)) → coil_it_out_ag(.(Line, Lines), even)
U12_ag(Line, Lines, coil_it_out_ag(Lines, even)) → coil_it_out_ag(.(Line, Lines), odd)
U7_gaa(Pattern, Cols, Rows, coil_it_out_ag(Snake, odd)) → snake_out_gaa(Pattern, Cols, Rows)
U3_ggg(Pattern, C, R, snake_out_gaa(Pattern, Cols, Rows)) → test_snake_out_ggg(Pattern, C, R)

The argument filtering Pi contains the following mapping:
test_snake_in_ggg(x1, x2, x3)  =  test_snake_in_ggg(x1, x2, x3)
U1_ggg(x1, x2, x3, x4)  =  U1_ggg(x1, x2, x3, x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga(x1)
s(x1)  =  s(x1)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x1, x4)
U2_ggg(x1, x2, x3, x4, x5)  =  U2_ggg(x1, x2, x3, x5)
U3_ggg(x1, x2, x3, x4)  =  U3_ggg(x1, x2, x3, x4)
snake_in_gaa(x1, x2, x3)  =  snake_in_gaa(x1)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x1, x4)
infinite_snake_in_gaa(x1, x2, x3)  =  infinite_snake_in_gaa(x1)
[]  =  []
infinite_snake_out_gaa(x1, x2, x3)  =  infinite_snake_out_gaa(x1)
.(x1, x2)  =  .(x1, x2)
U8_gaa(x1, x2, x3, x4, x5)  =  U8_gaa(x1, x2, x5)
U6_gaa(x1, x2, x3, x4)  =  U6_gaa(x1, x4)
produce_snake_in_aaaa(x1, x2, x3, x4)  =  produce_snake_in_aaaa
produce_snake_out_aaaa(x1, x2, x3, x4)  =  produce_snake_out_aaaa
U9_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U9_aaaa(x7)
part_of_snake_in_aaaa(x1, x2, x3, x4)  =  part_of_snake_in_aaaa
part_of_snake_out_aaaa(x1, x2, x3, x4)  =  part_of_snake_out_aaaa
U11_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U11_aaaa(x7)
U10_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U10_aaaa(x7)
U7_gaa(x1, x2, x3, x4)  =  U7_gaa(x1, x4)
coil_it_in_ag(x1, x2)  =  coil_it_in_ag(x2)
coil_it_out_ag(x1, x2)  =  coil_it_out_ag(x2)
odd  =  odd
U12_ag(x1, x2, x3)  =  U12_ag(x3)
even  =  even
U13_ag(x1, x2, x3)  =  U13_ag(x3)
reverse2_in_aa(x1, x2)  =  reverse2_in_aa
U15_aa(x1, x2, x3)  =  U15_aa(x3)
reverse_in_aga(x1, x2, x3)  =  reverse_in_aga(x2)
reverse_out_aga(x1, x2, x3)  =  reverse_out_aga(x2)
U16_aga(x1, x2, x3, x4, x5)  =  U16_aga(x3, x5)
reverse_in_aaa(x1, x2, x3)  =  reverse_in_aaa
reverse_out_aaa(x1, x2, x3)  =  reverse_out_aaa
U16_aaa(x1, x2, x3, x4, x5)  =  U16_aaa(x5)
reverse2_out_aa(x1, x2)  =  reverse2_out_aa
U14_ag(x1, x2, x3)  =  U14_ag(x3)
snake_out_gaa(x1, x2, x3)  =  snake_out_gaa(x1)
test_snake_out_ggg(x1, x2, x3)  =  test_snake_out_ggg(x1, x2, x3)
INFINITE_SNAKE_IN_GAA(x1, x2, x3)  =  INFINITE_SNAKE_IN_GAA(x1)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

INFINITE_SNAKE_IN_GAA(.(A, R), .(A, T), S) → INFINITE_SNAKE_IN_GAA(R, T, S)

R is empty.
The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x1, x2)
INFINITE_SNAKE_IN_GAA(x1, x2, x3)  =  INFINITE_SNAKE_IN_GAA(x1)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

INFINITE_SNAKE_IN_GAA(.(A, R)) → INFINITE_SNAKE_IN_GAA(R)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof

Pi DP problem:
The TRS P consists of the following rules:

S2L_IN_GA(s(X), .(X1, Y)) → S2L_IN_GA(X, Y)

The TRS R consists of the following rules:

test_snake_in_ggg(Pattern, C, R) → U1_ggg(Pattern, C, R, s2l_in_ga(C, Cols))
s2l_in_ga(0, []) → s2l_out_ga(0, [])
s2l_in_ga(s(X), .(X1, Y)) → U4_ga(X, X1, Y, s2l_in_ga(X, Y))
U4_ga(X, X1, Y, s2l_out_ga(X, Y)) → s2l_out_ga(s(X), .(X1, Y))
U1_ggg(Pattern, C, R, s2l_out_ga(C, Cols)) → U2_ggg(Pattern, C, R, Cols, s2l_in_ga(R, Rows))
U2_ggg(Pattern, C, R, Cols, s2l_out_ga(R, Rows)) → U3_ggg(Pattern, C, R, snake_in_gaa(Pattern, Cols, Rows))
snake_in_gaa(Pattern, Cols, Rows) → U5_gaa(Pattern, Cols, Rows, infinite_snake_in_gaa(Pattern, InfSnake, InfSnake))
infinite_snake_in_gaa([], S, S) → infinite_snake_out_gaa([], S, S)
infinite_snake_in_gaa(.(A, R), .(A, T), S) → U8_gaa(A, R, T, S, infinite_snake_in_gaa(R, T, S))
U8_gaa(A, R, T, S, infinite_snake_out_gaa(R, T, S)) → infinite_snake_out_gaa(.(A, R), .(A, T), S)
U5_gaa(Pattern, Cols, Rows, infinite_snake_out_gaa(Pattern, InfSnake, InfSnake)) → U6_gaa(Pattern, Cols, Rows, produce_snake_in_aaaa(Rows, Cols, InfSnake, Snake))
produce_snake_in_aaaa([], X, X1, []) → produce_snake_out_aaaa([], X, X1, [])
produce_snake_in_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail)) → U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_in_aaaa(Cols, InfSnake, NewInfSnake, Part))
part_of_snake_in_aaaa([], RestSnake, RestSnake, []) → part_of_snake_out_aaaa([], RestSnake, RestSnake, [])
part_of_snake_in_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings)) → U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_in_aaaa(R, Rings, RestSnake, RestRings))
U11_aaaa(X, R, Ring, Rings, RestSnake, RestRings, part_of_snake_out_aaaa(R, Rings, RestSnake, RestRings)) → part_of_snake_out_aaaa(.(X, R), .(Ring, Rings), RestSnake, .(Ring, RestRings))
U9_aaaa(X, Rows, Cols, InfSnake, Part, Tail, part_of_snake_out_aaaa(Cols, InfSnake, NewInfSnake, Part)) → U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_in_aaaa(Rows, Cols, NewInfSnake, Tail))
U10_aaaa(X, Rows, Cols, InfSnake, Part, Tail, produce_snake_out_aaaa(Rows, Cols, NewInfSnake, Tail)) → produce_snake_out_aaaa(.(X, Rows), Cols, InfSnake, .(Part, Tail))
U6_gaa(Pattern, Cols, Rows, produce_snake_out_aaaa(Rows, Cols, InfSnake, Snake)) → U7_gaa(Pattern, Cols, Rows, coil_it_in_ag(Snake, odd))
coil_it_in_ag([], X) → coil_it_out_ag([], X)
coil_it_in_ag(.(Line, Lines), odd) → U12_ag(Line, Lines, coil_it_in_ag(Lines, even))
coil_it_in_ag(.(Line, Lines), even) → U13_ag(Line, Lines, reverse2_in_aa(Line, Line1))
reverse2_in_aa(List, Reversed) → U15_aa(List, Reversed, reverse_in_aga(List, [], Reversed))
reverse_in_aga([], Reversed, Reversed) → reverse_out_aga([], Reversed, Reversed)
reverse_in_aga(.(Head, Tail), SoFar, Reversed) → U16_aga(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
reverse_in_aaa([], Reversed, Reversed) → reverse_out_aaa([], Reversed, Reversed)
reverse_in_aaa(.(Head, Tail), SoFar, Reversed) → U16_aaa(Head, Tail, SoFar, Reversed, reverse_in_aaa(Tail, .(Head, SoFar), Reversed))
U16_aaa(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aaa(.(Head, Tail), SoFar, Reversed)
U16_aga(Head, Tail, SoFar, Reversed, reverse_out_aaa(Tail, .(Head, SoFar), Reversed)) → reverse_out_aga(.(Head, Tail), SoFar, Reversed)
U15_aa(List, Reversed, reverse_out_aga(List, [], Reversed)) → reverse2_out_aa(List, Reversed)
U13_ag(Line, Lines, reverse2_out_aa(Line, Line1)) → U14_ag(Line, Lines, coil_it_in_ag(Lines, odd))
U14_ag(Line, Lines, coil_it_out_ag(Lines, odd)) → coil_it_out_ag(.(Line, Lines), even)
U12_ag(Line, Lines, coil_it_out_ag(Lines, even)) → coil_it_out_ag(.(Line, Lines), odd)
U7_gaa(Pattern, Cols, Rows, coil_it_out_ag(Snake, odd)) → snake_out_gaa(Pattern, Cols, Rows)
U3_ggg(Pattern, C, R, snake_out_gaa(Pattern, Cols, Rows)) → test_snake_out_ggg(Pattern, C, R)

The argument filtering Pi contains the following mapping:
test_snake_in_ggg(x1, x2, x3)  =  test_snake_in_ggg(x1, x2, x3)
U1_ggg(x1, x2, x3, x4)  =  U1_ggg(x1, x2, x3, x4)
s2l_in_ga(x1, x2)  =  s2l_in_ga(x1)
0  =  0
s2l_out_ga(x1, x2)  =  s2l_out_ga(x1)
s(x1)  =  s(x1)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x1, x4)
U2_ggg(x1, x2, x3, x4, x5)  =  U2_ggg(x1, x2, x3, x5)
U3_ggg(x1, x2, x3, x4)  =  U3_ggg(x1, x2, x3, x4)
snake_in_gaa(x1, x2, x3)  =  snake_in_gaa(x1)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x1, x4)
infinite_snake_in_gaa(x1, x2, x3)  =  infinite_snake_in_gaa(x1)
[]  =  []
infinite_snake_out_gaa(x1, x2, x3)  =  infinite_snake_out_gaa(x1)
.(x1, x2)  =  .(x1, x2)
U8_gaa(x1, x2, x3, x4, x5)  =  U8_gaa(x1, x2, x5)
U6_gaa(x1, x2, x3, x4)  =  U6_gaa(x1, x4)
produce_snake_in_aaaa(x1, x2, x3, x4)  =  produce_snake_in_aaaa
produce_snake_out_aaaa(x1, x2, x3, x4)  =  produce_snake_out_aaaa
U9_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U9_aaaa(x7)
part_of_snake_in_aaaa(x1, x2, x3, x4)  =  part_of_snake_in_aaaa
part_of_snake_out_aaaa(x1, x2, x3, x4)  =  part_of_snake_out_aaaa
U11_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U11_aaaa(x7)
U10_aaaa(x1, x2, x3, x4, x5, x6, x7)  =  U10_aaaa(x7)
U7_gaa(x1, x2, x3, x4)  =  U7_gaa(x1, x4)
coil_it_in_ag(x1, x2)  =  coil_it_in_ag(x2)
coil_it_out_ag(x1, x2)  =  coil_it_out_ag(x2)
odd  =  odd
U12_ag(x1, x2, x3)  =  U12_ag(x3)
even  =  even
U13_ag(x1, x2, x3)  =  U13_ag(x3)
reverse2_in_aa(x1, x2)  =  reverse2_in_aa
U15_aa(x1, x2, x3)  =  U15_aa(x3)
reverse_in_aga(x1, x2, x3)  =  reverse_in_aga(x2)
reverse_out_aga(x1, x2, x3)  =  reverse_out_aga(x2)
U16_aga(x1, x2, x3, x4, x5)  =  U16_aga(x3, x5)
reverse_in_aaa(x1, x2, x3)  =  reverse_in_aaa
reverse_out_aaa(x1, x2, x3)  =  reverse_out_aaa
U16_aaa(x1, x2, x3, x4, x5)  =  U16_aaa(x5)
reverse2_out_aa(x1, x2)  =  reverse2_out_aa
U14_ag(x1, x2, x3)  =  U14_ag(x3)
snake_out_gaa(x1, x2, x3)  =  snake_out_gaa(x1)
test_snake_out_ggg(x1, x2, x3)  =  test_snake_out_ggg(x1, x2, x3)
S2L_IN_GA(x1, x2)  =  S2L_IN_GA(x1)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof

Pi DP problem:
The TRS P consists of the following rules:

S2L_IN_GA(s(X), .(X1, Y)) → S2L_IN_GA(X, Y)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
.(x1, x2)  =  .(x1, x2)
S2L_IN_GA(x1, x2)  =  S2L_IN_GA(x1)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof

Q DP problem:
The TRS P consists of the following rules:

S2L_IN_GA(s(X)) → S2L_IN_GA(X)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs: